0

In my code I'm using RSyntaxTextArea and RTextScrollPane but the line numbers of the RTextScrollPane are not perfectly aligned with the lines of the RSyntaxTextArea.

Here is my code :

RSyntaxTextArea tabTextArea = new RSyntaxTextArea();
tabTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
tabTextArea.setCodeFoldingEnabled(true);
tabTextArea.setAntiAliasingEnabled(true);

RTextScrollPane tabScrollPane = new RTextScrollPane(tabTextArea);
tabScrollPane.setLineNumbersEnabled(true);
tabScrollPane.getGutter().setSpacingBetweenLineNumbersAndFoldIndicator(10);

I've also changed the font in another part of the code, here are the parts where I made these :

For the RTextScrollPane (fontText is "OCR A Extended") :

((RTextScrollPane) (((SwingNode) tab.getContent()).getContent())).getGutter().setLineNumberFont(new Font(fontText, Font.PLAIN, 14));

For the RSyntaxTextArea (OCR_FONT_FAMILY is same as fontText) :

rSyntaxTextArea.setFont(new Font(OCR_FONT_FAMILY, Font.PLAIN, 14));

It's the same font and same size but it's not aligned. Can someone help me ? And an important important information is that if I do not set theses font it's perfectly aligned.

Thanks !

TRKirua
  • 11
  • 2
  • 3
    Why is this marked JavaFX? [RSyntaxTextArea](https://bobbylight.github.io/RSyntaxTextArea/) is a Swing control. – jewelsea Jul 06 '23 at 18:08

0 Answers0