Yes, comments are by default italic, and keywords bold. Unfortunately the syntax styling API isn't as nice as I'd like it to be, but I hope to update that soon.
You can remove the italics (and bold, if you wish) by looping through all of the
Styles in the text area's
SyntaxScheme. Here is an example utility method that makes RSTA use a single font (no bold or italics) for all token types:
- Code: Select all
public static void setFont(RSyntaxTextArea textArea, Font font) {
if (font!=null) {
SyntaxScheme ss = textArea.getSyntaxScheme();
if (ss!=null) {
ss = (SyntaxScheme)ss.clone();
for (int i=0; i<ss.styles.length; i++) {
if (ss.styles[i]!=null) {
ss.styles[i].font = font;
}
}
textArea.setSyntaxScheme(ss);
}
textArea.setFont(font);
}
}
You could modify this method to change any font found to Font.PLAIN:
- Code: Select all
if (ss.styles[i]!=null && ss.styles[i].font!=null) {
ss.styles[i].font = ss.styles[i].font.deriveFont(Font.PLAIN);
}
Bringing this up has made me want to update this API sooner rather than later.
