Java Code Examples for javax.swing.text.StyleConstants#setFontSize()

The following examples show how to use javax.swing.text.StyleConstants#setFontSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JConsole.java    From MeteoInfo with GNU Lesser General Public License v3.0 6 votes vote down vote up
private AttributeSet setStyle(
        String fontFamilyName,
        int size,
        Color color,
        boolean bold,
        boolean italic,
        boolean underline
) {
    MutableAttributeSet attr = new SimpleAttributeSet();
    if (color != null) {
        StyleConstants.setForeground(attr, color);
    }
    if (fontFamilyName != null) {
        StyleConstants.setFontFamily(attr, fontFamilyName);
    }
    if (size != -1) {
        StyleConstants.setFontSize(attr, size);
    }
    StyleConstants.setBold(attr, bold);
    StyleConstants.setItalic(attr, italic);
    StyleConstants.setUnderline(attr, underline);

    setStyle(attr);

    return getStyle();
}
 
Example 2
Source File: ConsoleStdoutDocument.java    From binnavi with Apache License 2.0 6 votes vote down vote up
public ConsoleStdoutDocument() {
  StyleConstants.setFontFamily(outputAttrA, GuiHelper.getMonospaceFont());
  StyleConstants.setFontSize(outputAttrA, 11);
  StyleConstants.setForeground(outputAttrA, new Color((float) .4, (float) .4, (float) .4));

  StyleConstants.setFontFamily(outputAttrB, GuiHelper.getMonospaceFont());
  StyleConstants.setFontSize(outputAttrB, 11);
  StyleConstants.setForeground(outputAttrB, new Color((float) .1, (float) .1, (float) .1));

  StyleConstants.setFontFamily(outputErrAttr, GuiHelper.getMonospaceFont());
  StyleConstants.setFontSize(outputErrAttr, 11);
  StyleConstants.setForeground(outputErrAttr, new Color(1, (float) .2, (float) .2));

  lastPosition = 0;
  flipflop = false;
  outputAttr = outputAttrA;
}
 
Example 3
Source File: JConsole.java    From beanshell with Apache License 2.0 6 votes vote down vote up
private AttributeSet setStyle(
    String fontFamilyName,
    int size,
    Color color,
    boolean bold,
    boolean italic,
    boolean underline
    )
{
    MutableAttributeSet attr = new SimpleAttributeSet();
    if (color!=null)
        StyleConstants.setForeground(attr, color);
    if (fontFamilyName!=null)
        StyleConstants.setFontFamily(attr, fontFamilyName);
    if (size!=-1)
        StyleConstants.setFontSize(attr, size);
    StyleConstants.setBold(attr, bold);
    StyleConstants.setItalic(attr, italic);
    StyleConstants.setUnderline(attr, underline);

    setStyle(attr);

    return getStyle();
}
 
Example 4
Source File: DisplayArea.java    From android-classyshark with Apache License 2.0 6 votes vote down vote up
@Override
public void displaySharkey() {
    displayDataState = DisplayDataState.SHARKEY;
    clearText();
    style = jTextPane.addStyle("STYLE", null);
    Document doc = jTextPane.getStyledDocument();

    try {
        StyleConstants.setForeground(style, theme.getIdentifiersColor());
        StyleConstants.setFontSize(style, 15);
        StyleConstants.setFontFamily(style, "Monospaced");

        doc.insertString(doc.getLength(), Doodle.get(), style);
    } catch (BadLocationException e) {
        e.printStackTrace();
    }

    jTextPane.setDocument(doc);
}
 
Example 5
Source File: DisplayArea.java    From android-classyshark with Apache License 2.0 6 votes vote down vote up
@Override
public void displayError() {
    displayDataState = DisplayDataState.ERROR;
    clearText();

    style = jTextPane.addStyle("STYLE", null);
    Document doc = jTextPane.getStyledDocument();

    try {
        StyleConstants.setForeground(style, theme.getDefaultColor());
        StyleConstants.setFontSize(style, 15);
        StyleConstants.setFontFamily(style, "Monospaced");

        doc.insertString(doc.getLength(), "\n\n\n\t\t\t There was a problem loading the class  ", style);
        doc.insertString(doc.getLength(), Doodle.get(), style);
    } catch (BadLocationException e) {
        e.printStackTrace();
    }

    jTextPane.setDocument(doc);
}
 
Example 6
Source File: AboutDialog.java    From Spade with GNU General Public License v3.0 6 votes vote down vote up
public static void addStylesToDocument(StyledDocument doc)
{
	//Initialize some styles.
	Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
	
	Style regular = doc.addStyle("regular", def);
	StyleConstants.setFontFamily(def, "SansSerif");
	
	Style s = doc.addStyle("italic", regular);
	StyleConstants.setItalic(s, true);
	
	s = doc.addStyle("bold", regular);
	StyleConstants.setBold(s, true);
	
	s = doc.addStyle("small", regular);
	StyleConstants.setFontSize(s, 10);
	
	s = doc.addStyle("large", regular);
	StyleConstants.setFontSize(s, 16);
	StyleConstants.setBold(s, true);
}
 
Example 7
Source File: JTerm.java    From MobyDroid with Apache License 2.0 6 votes vote down vote up
public JTerm(JTextPane jTextPane, JTermInputProcessor process, Color background, Color text, Font font) {
    super();
    jTermTextPane = jTextPane;
    processor = process;
    jTermDoc = new JTermDocument();
    jTermTextPane.setDocument(jTermDoc);

    jTermTextPane.setBackground(background);

    jTermTextPane.setCaretColor(text);
    jTermTextPane.addCaretListener(jTermDoc);
    jTermDoc.setCaret(jTermTextPane.getCaret());

    defaultStyle = jTermTextPane.getInputAttributes();
    StyleConstants.setFontFamily(defaultStyle, font.getFamily());
    StyleConstants.setFontSize(defaultStyle, font.getSize());
    StyleConstants.setItalic(defaultStyle, (font.getStyle() & Font.ITALIC) != 0);
    StyleConstants.setBold(defaultStyle, (font.getStyle() & Font.BOLD) != 0);
    StyleConstants.setForeground(defaultStyle, text);
    jTermDoc.setCharacterAttributes(0, jTermDoc.getLength() + 1, defaultStyle, false);

    jTermTextPane.addKeyListener(new JTermKeyListener()); //catch tabs, enters, and up/down arrows for autocomplete and input processing
    jTermTextPane.addMouseListener(new JTermMouseListener());
}
 
Example 8
Source File: JConsole.java    From MeteoInfo with GNU Lesser General Public License v3.0 6 votes vote down vote up
private AttributeSet setStyle(
        String fontFamilyName, int size, Color color) {
    MutableAttributeSet attr = new SimpleAttributeSet();
    if (color != null) {
        StyleConstants.setForeground(attr, color);
    }
    if (fontFamilyName != null) {
        StyleConstants.setFontFamily(attr, fontFamilyName);
    }
    if (size != -1) {
        StyleConstants.setFontSize(attr, size);
    }

    setStyle(attr);

    return getStyle();
}
 
Example 9
Source File: SoapMessageColorizer.java    From otroslogviewer with Apache License 2.0 5 votes vote down vote up
private void initStyles() {
  StyleContext sc = new StyleContext();
  Style parent = sc.getStyle(StyleContext.DEFAULT_STYLE);

  StyleConstants.setFontFamily(parent, "courier");
  StyleConstants.setFontSize(parent, 13);

  styleElementName = sc.addStyle("elementName", parent);
  StyleConstants.setForeground(styleElementName, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_ELEMENT_NAME));

  styleAttributeName = sc.addStyle("attributeName", parent);
  StyleConstants.setForeground(styleAttributeName, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_ATTRIBUTE_NAME));

  styleAttributeValue = sc.addStyle("attributeValue", parent);
  StyleConstants.setForeground(styleAttributeValue, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_ATTRIBUTE_VALUE));

  styleContent = sc.addStyle("content", parent);
  StyleConstants.setBackground(styleContent, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_CONTENT_BACKGROUND));
  StyleConstants.setForeground(styleContent, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_CONTENT_FOREGROUND));

  styleOperator = sc.addStyle("operator", parent);
  StyleConstants.setForeground(styleOperator, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_OPERATOR));
  StyleConstants.setBold(styleOperator, true);

  styleComments = sc.addStyle("comments", parent);
  StyleConstants.setForeground(styleComments, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_COMMENTS));

  styleCData = sc.addStyle("cdata", parent);
  StyleConstants.setForeground(styleCData, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_CDATA_FOREGROUND));
  StyleConstants.setBackground(styleCData, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_CDATA_BACKGROUND));

  styleDOCTYPE = sc.addStyle("doctype", sc.addStyle("doctype", parent));
}
 
Example 10
Source File: MyTextPane.java    From myqq with MIT License 5 votes vote down vote up
/**
 * 获取某种字体
 * @param name 字体名称
 * @param size 字体大小
 * @param color 字体颜色
 * @param bold 是否加粗
 * @param underline 是否加下划线
 * @return 返回获取的字体
 */
public static SimpleAttributeSet getFontAttribute(String name, int size, Color color,
		boolean bold, boolean underline)
{
	SimpleAttributeSet attribute = new SimpleAttributeSet();
	StyleConstants.setFontFamily(attribute, name);
	StyleConstants.setFontSize(attribute, size);
	StyleConstants.setForeground(attribute, color);
	StyleConstants.setBold(attribute, bold);
	StyleConstants.setUnderline(attribute, underline);
	return attribute;
}
 
Example 11
Source File: JViewPortBackingStoreImageTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static void createStyles() {
    styles = new StyleContext();
    doc = new DefaultStyledDocument(styles);
    contentAttributes = new HashMap<>();

    // no attributes defined
    Style s = styles.addStyle(null, null);
    contentAttributes.put("none", s);

    Style def = styles.getStyle(StyleContext.DEFAULT_STYLE);

    Style heading = styles.addStyle("heading", def);
    StyleConstants.setFontFamily(heading, "SansSerif");
    StyleConstants.setBold(heading, true);
    StyleConstants.setAlignment(heading, StyleConstants.ALIGN_CENTER);
    StyleConstants.setSpaceAbove(heading, 10);
    StyleConstants.setSpaceBelow(heading, 10);
    StyleConstants.setFontSize(heading, 18);

    // Title
    Style sty = styles.addStyle("title", heading);
    StyleConstants.setFontSize(sty, 32);

    // author
    sty = styles.addStyle("author", heading);
    StyleConstants.setItalic(sty, true);
    StyleConstants.setSpaceBelow(sty, 25);
}
 
Example 12
Source File: BaseTypeTableCellRenderer.java    From binnavi with Apache License 2.0 5 votes vote down vote up
private static Style createDataStyle(final StyledDocument document) {
  final Style declStyle = document.addStyle("DATA_STYLE", null);
  StyleConstants.setBackground(declStyle, Color.WHITE);
  StyleConstants.setForeground(declStyle, Color.BLUE);
  StyleConstants.setFontFamily(declStyle, GuiHelper.getMonospaceFont());
  StyleConstants.setFontSize(declStyle, 11);
  return declStyle;
}
 
Example 13
Source File: BaseTypeTableCellRenderer.java    From binnavi with Apache License 2.0 5 votes vote down vote up
private static Style createDeclarationStyle(final StyledDocument document) {
  final Style declStyle = document.addStyle("DECL_STYLE", null);
  StyleConstants.setBackground(declStyle, Color.WHITE);
  StyleConstants.setForeground(declStyle, Color.BLACK);
  StyleConstants.setFontFamily(declStyle, GuiHelper.getMonospaceFont());
  StyleConstants.setFontSize(declStyle, 11);
  return declStyle;
}
 
Example 14
Source File: ConsoleCodeDocument.java    From binnavi with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor. Sets up the styles and add the strings to be highlighted into the corresponding
 * vectors.
 */
public ConsoleCodeDocument() {
  super(false);

  putProperty(DefaultEditorKit.EndOfLineStringProperty, "\n");

  StyleConstants.setForeground(pythonPromptAttr, Color.LIGHT_GRAY);
  StyleConstants.setBold(pythonPromptAttr, true);
  StyleConstants.setFontSize(pythonPromptAttr, 13);
}
 
Example 15
Source File: TextPaneAppender.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public
void setFontSize(int size) {
  Enumeration e = attributes.elements();
  while (e.hasMoreElements()) {
    StyleConstants.setFontSize((MutableAttributeSet)e.nextElement(),size);
  }
  return;
}
 
Example 16
Source File: StyleProperties.java    From otroslogviewer with Apache License 2.0 4 votes vote down vote up
public static Style getStyle(Theme.Type themeType,StyleContext styleContext, DataConfiguration styleConfig, String styleName, int group) {
  Style style = styleContext.addStyle(styleName, styleContext.getStyle(StyleContext.DEFAULT_STYLE));

  final String groupSuffix;
  if (group <= 0) {
    groupSuffix = "";
  } else {
    groupSuffix = "." + group;
  }

  String fontFamily = styleConfig.getString(PROP_FONT_FAMILY + groupSuffix, "");
  if (fontFamily.trim().length() > 0) {
    StyleConstants.setFontFamily(style, styleConfig.getString(PROP_FONT_FAMILY + groupSuffix));
  }

  if (styleConfig.getString(PROP_FONT_SIZE + groupSuffix, "").trim().length() > 0) {
    StyleConstants.setFontSize(style, styleConfig.getInt(PROP_FONT_SIZE + groupSuffix));
  }

  if (styleConfig.getString(PROP_FONT_BOLD + groupSuffix, "").trim().length() > 0) {
    StyleConstants.setBold(style, styleConfig.getBoolean(PROP_FONT_BOLD + groupSuffix));
  }

  if (styleConfig.getString(PROP_FONT_ITALIC + groupSuffix, "").trim().length() > 0) {
    StyleConstants.setItalic(style, styleConfig.getBoolean(PROP_FONT_ITALIC + groupSuffix));
  }

  if (styleConfig.getString(PROP_FONT_UNDERLINE + groupSuffix, "").trim().length() > 0) {
    StyleConstants.setUnderline(style, styleConfig.getBoolean(PROP_FONT_UNDERLINE + groupSuffix));
  }

  String theme;
  if (themeType.equals(Theme.Type.Light)) {
    theme = "light";
  } else {
    theme = "dark";
  }

  if (styleConfig.getString(PROP_BACKGROUND + groupSuffix + "." + theme,"").trim().length() > 0) {
    StyleConstants.setBackground(style, styleConfig.getColor(PROP_BACKGROUND + groupSuffix + "." + theme, null));
  } else if (styleConfig.getString(PROP_BACKGROUND + groupSuffix, "").trim().length() > 0) {
    StyleConstants.setBackground(style, styleConfig.getColor(PROP_BACKGROUND + groupSuffix));
  }

  if (styleConfig.getString(PROP_FOREGROUND + groupSuffix + "." + theme,"").trim().length() > 0) {
    StyleConstants.setForeground(style, styleConfig.getColor(PROP_FOREGROUND + groupSuffix + "." + theme, null));
  } else if (styleConfig.getString(PROP_FOREGROUND + groupSuffix, "").trim().length() > 0) {
    StyleConstants.setForeground(style, styleConfig.getColor(PROP_FOREGROUND + groupSuffix));
  }

  return style;
}
 
Example 17
Source File: ModelItem.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void updateTextPaneImpl(JTextPane pane) throws BadLocationException {
    Style defaultStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
    StyledDocument doc = pane.getStyledDocument();
    Style boldStyle = doc.addStyle("bold", defaultStyle);
    StyleConstants.setBold(boldStyle, true);
    Style errorStyle = doc.addStyle("error", defaultStyle);
    StyleConstants.setBold(errorStyle, true);
    StyleConstants.setForeground(errorStyle, Color.red);
    Style paragraphStyle = doc.addStyle("paragraph", defaultStyle);
    StyleConstants.setFontSize(paragraphStyle, StyleConstants.getFontSize(paragraphStyle)+5);
    StyleConstants.setForeground(paragraphStyle, Color.gray);
    pane.setText("");

    if (request != null) {
        doc.insertString(doc.getLength(), "Request URL: ", boldStyle);
        doc.insertString(doc.getLength(), (String)request.getRequest().get("url")+"\n", defaultStyle);
        doc.insertString(doc.getLength(), "Method: ", boldStyle);
        doc.insertString(doc.getLength(), (String)request.getRequest().get("method")+"\n", defaultStyle);
        JSONObject r = getResponseHeaders();
        if (r != null) {
            int statusCode = request.getResponseCode();
            doc.insertString(doc.getLength(), "Status: ", boldStyle);
            String status = (String)r.get("Status");
            if (status == null) {
                status = statusCode == -1 ? "" : ""+statusCode +
                        " " + request.getResponse().get("statusText");
            }
            doc.insertString(doc.getLength(), status+"\n",
                    statusCode >= 400 ? errorStyle : defaultStyle);
            Boolean fromCache = (Boolean)r.get("fromDiskCache");
            if (Boolean.TRUE.equals(fromCache)) {
                doc.insertString(doc.getLength(), "From Disk Cache: ", boldStyle);
                doc.insertString(doc.getLength(), "yes\n", defaultStyle);
            }
        } else if (request.isFailed()) {
            doc.insertString(doc.getLength(), "Status: ", boldStyle);
            doc.insertString(doc.getLength(), "Request was cancelled.\n", errorStyle);
        }
    } else {
        doc.insertString(doc.getLength(), "Request URL: ", boldStyle);
        doc.insertString(doc.getLength(), wsRequest.getURL()+"\n", defaultStyle);
        doc.insertString(doc.getLength(), "Status: ", boldStyle);
        if (wsRequest.getErrorMessage() != null) {
            doc.insertString(doc.getLength(), wsRequest.getErrorMessage()+"\n", errorStyle);
        } else {
            doc.insertString(doc.getLength(), wsRequest.isClosed() ? "Closed\n" :
                wsRequest.getHandshakeResponse() == null ? "Opening\n" : "Open\n", defaultStyle);
        }
    }

    JSONObject requestHeaders = getRequestHeaders();
    if (requestHeaders == null) {
        return;
    }
    doc.insertString(doc.getLength(), "\n", defaultStyle);
    doc.insertString(doc.getLength(), "Request Headers\n", paragraphStyle);
    printHeaders(pane, requestHeaders, doc, boldStyle, defaultStyle);

    if (getResponseHeaders() != null) {
        doc.insertString(doc.getLength(), "\n", defaultStyle);
        doc.insertString(doc.getLength(), "Response Headers\n", paragraphStyle);
        printHeaders(pane, getResponseHeaders(), doc, boldStyle, defaultStyle);
    }
}
 
Example 18
Source File: JavaSourceDocument.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
public JavaSourceDocument(String title, Reader in, SourceFile theSource) throws IOException {
    doc = new DefaultStyledDocument();
    this.title = title;
    this.sourceFile = theSource;
    Debug.println("Created JavaSourceDocument for " + title);
    try {
        dek.read(in, doc, 0);
    } catch (BadLocationException e) {
        throw new RuntimeException(e);
    }
    in.close();
    doc.putProperty(Document.TitleProperty, title);
    //        root = doc.getDefaultRootElement();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    FontMetrics fontMetrics = toolkit.getFontMetrics(sourceFont);
    TabStop[] tabs = new TabStop[50];
    float width = fontMetrics.stringWidth(" ");

    int tabSize = GUISaveState.getInstance().getTabSize();
    for (int i = 0; i < tabs.length; i++) {
        tabs[i] = new TabStop(width * (tabSize + tabSize * i));
    }
    TAB_SET = new TabSet(tabs);
    StyleConstants.setTabSet(commentAttributes, TAB_SET);
    StyleConstants.setTabSet(javadocAttributes, TAB_SET);

    StyleConstants.setTabSet(quotesAttributes, TAB_SET);

    StyleConstants.setTabSet(keywordsAttributes, TAB_SET);

    StyleConstants.setTabSet(commentAttributes, TAB_SET);

    StyleConstants.setTabSet(whiteAttributes, TAB_SET);
    StyleConstants.setFontFamily(whiteAttributes, sourceFont.getFamily());
    StyleConstants.setFontSize(whiteAttributes, sourceFont.getSize());
    StyleConstants.setLeftIndent(whiteAttributes, NumberedParagraphView.NUMBERS_WIDTH);

    doc.setParagraphAttributes(0, doc.getLength(), whiteAttributes, true);
    JavaScanner parser = new JavaScanner(new DocumentCharacterIterator(doc));
    while (parser.next() != JavaScanner.EOF) {
        int kind = parser.getKind();
        switch (kind) {
        case JavaScanner.COMMENT:
            doc.setCharacterAttributes(parser.getStartPosition(), parser.getLength(), commentAttributes, true);
            break;

        case JavaScanner.KEYWORD:
            doc.setCharacterAttributes(parser.getStartPosition(), parser.getLength(), keywordsAttributes, true);
            break;

        case JavaScanner.JAVADOC:
            doc.setCharacterAttributes(parser.getStartPosition(), parser.getLength(), javadocAttributes, true);
            break;

        case JavaScanner.QUOTE:
            doc.setCharacterAttributes(parser.getStartPosition(), parser.getLength(), quotesAttributes, true);
            break;

        default:
            break;
        }

    }

}
 
Example 19
Source File: DisplayArea.java    From android-classyshark with Apache License 2.0 4 votes vote down vote up
@Override
public void displaySearchResults(List<String> filteredClassNames,
                                 List<Translator.ELEMENT> displayedManifestSearchResultsTokens,
                                 String textFromTypingArea) {
    displayDataState = DisplayDataState.CLASSES_LIST;
    StyleConstants.setFontSize(style, 20);
    StyleConstants.setForeground(style, theme.getIdentifiersColor());

    clearText();

    Document doc = new DefaultStyledDocument();
    jTextPane.setDocument(doc);

    StyleConstants.setFontSize(style, 20);
    StyleConstants.setBackground(style, theme.getBackgroundColor());

    fillTokensToDoc(displayedManifestSearchResultsTokens, doc, true);

    StyleConstants.setFontSize(style, 20);
    StyleConstants.setForeground(style, theme.getIdentifiersColor());
    StyleConstants.setBackground(style, theme.getBackgroundColor());


    int displayedClassLimit = 50;

    if(filteredClassNames.size() < displayedClassLimit) {
        displayedClassLimit = filteredClassNames.size();
    }

    for (int i = 0; i < displayedClassLimit; i++) {
        try {
            doc.insertString(doc.getLength(), filteredClassNames.get(i) + "\n", style);
        } catch (BadLocationException e) {
            e.printStackTrace();
        }
    }

    jTextPane.setDocument(doc);

    jTextPane.setCaretPosition(1);
}
 
Example 20
Source File: FormattedTextHelper.java    From PolyGlot with MIT License 4 votes vote down vote up
/**
 * Restores to the JTextPane the formatted text values encoded in the saved
 * value string
 * @param savedVal value to restore formatted text from
 * @param pane Text pane to restore formatted text to.
 * @param core Dictionary Core (needed for references)
 * @throws javax.swing.text.BadLocationException if unable to load
 */
public static void restoreFromString(String savedVal, JTextPane pane, DictCore core) throws BadLocationException {
    String remaining = savedVal;
    pane.setText("");
    Color fontColor = Color.black;
    String font = "";
    int fontSize = -1;
            
    while (!remaining.isEmpty()) {
        String nextNode = getNextNode(remaining);
        Font conFont = core.getPropertiesManager().getFontCon();
        
        remaining = remaining.substring(nextNode.length());
        
        if (nextNode.startsWith("<font")) {
            
            font = extractFamily(nextNode);
            fontSize = extractSize(nextNode);
            fontColor = extractColor(nextNode);
            
            if (font.equals(conFont.getFamily())) {
                font = PGTUtil.CONLANG_FONT;
            }
        } else if (nextNode.startsWith("</font")) {
            // do nothing
        } else if (nextNode.startsWith("<img src=")) {
            String idString = nextNode.replace("<img src=\"", "").replace("\">", "");
            Integer id = Integer.parseInt(idString);
            ImageNode imageNode = (ImageNode)core.getImageCollection().getNodeById(id);
            ((PGrammarPane)pane).addImage(imageNode);      
        } else {
            Document doc = pane.getDocument();
            
            MutableAttributeSet aset = new SimpleAttributeSet();
            if (font.equals(PGTUtil.CONLANG_FONT)) {
                if (core.getPropertiesManager().isEnforceRTL()) {
                    nextNode = PGTUtil.RTL_CHARACTER + nextNode;
                }
                StyleConstants.setFontFamily(aset, conFont.getFamily());
            } else {
                if (core.getPropertiesManager().isEnforceRTL()) {
                    nextNode = PGTUtil.LTR_MARKER + nextNode;
                }
                if (!font.isEmpty()) {
                    StyleConstants.setFontFamily(aset, font);
                }
            }
            
            if (fontSize != -1) {
                StyleConstants.setFontSize(aset, fontSize);
            }
            
            StyleConstants.setForeground(aset, fontColor);
            
            if (!nextNode.isEmpty()){
                doc.insertString(doc.getLength(), nextNode, aset);
            }
        }
    }
}