Search in sources :

Example 1 with TeXIcon

use of org.scilab.forge.jlatexmath.TeXIcon in project freeplane by freeplane.

the class LatexRenderer method getIcon.

@Override
public Icon getIcon(TextController textController, Object content, NodeModel node, Object transformedExtension) {
    if (transformedExtension == node.getUserObject()) {
        String string = content.toString();
        String nodeFormat = textController.getNodeFormat(node);
        if (PatternFormat.IDENTITY_PATTERN.equals(nodeFormat))
            return null;
        final String latext = getLatexNode(string, nodeFormat, TargetMode.FOR_ICON);
        if (latext == null)
            return null;
        final NodeStyleController ncs = NodeStyleController.getController(textController.getModeController());
        final int maxWidth = ncs.getMaxWidth(node).toBaseUnitsRounded();
        TeXText teXt = new TeXText(latext);
        int fontSize = Math.round(ncs.getFontSize(node) * UITools.FONT_SCALE_FACTOR);
        TeXIcon icon = teXt.createTeXIcon(TeXConstants.STYLE_DISPLAY, fontSize, TeXConstants.ALIGN_LEFT, maxWidth);
        return icon;
    }
    return null;
}
Also used : NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) TeXIcon(org.scilab.forge.jlatexmath.TeXIcon)

Aggregations

NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)1 TeXIcon (org.scilab.forge.jlatexmath.TeXIcon)1