Open Jankbyte opened 2 years ago
@ByteC0d3
I also came across this problem when I tried wrapping RSyntaxTextArea
in SwingNode
(when I initially started writing my IDE) and this is not related to fonts.
In the end, it was JavaFX that was causing this problem due to some mismatch or unsupported antialiasing support for Swing Components, I didn't actually dig deeper into it and switched the entire app to Swing(flexible API rocks).
You could try handling GraphicsContext
of your SwingNode
to see if the problem persists.
There have been (still are, probably?) other issues with embedding RSTA in JavaFX apps. I agree with @omegaui and don't think embedding custom-rendered Swing components in JavaFX is fully baked.
What does RSyntaxUtilities.getBestPossibleAntiAliasHints()
return in each test case? This might be the starting point of the issue - that e.g. awt.font.desktophints
is null
and so RSTA is resorting to Swing's software font rendering.
There have been (still are, probably?) other issues with embedding RSTA in JavaFX apps. I agree with @omegaui and don't think embedding custom-rendered Swing components in JavaFX is fully baked.
What does
RSyntaxUtilities.getBestPossibleAntiAliasHints()
return in each test case? This might be the starting point of the issue - that e.g.awt.font.desktophints
isnull
and so RSTA is resorting to Swing's software font rendering.
Sorry for so long answer about that (i returned back to my project).
Idk how i can test RSyntaxUtilities.getBestPossibleAntiAliasHints()
, but i run this inside main
method of my application:
public static void main(String[] args) {
Map<?,?> values = getBestPossibleAntiAliasHints();
values.entrySet().forEach(entry -> {
System.out.printf("%s, %s\n", entry.getKey(), entry.getValue());
});
launch(args);
}
And got next results at console:
Text-specific antialiasing enable key, LCD HRGB antialiasing text mode
Text-specific LCD contrast key, 120
P.S. After sometime i changed my OS from win10 to win11 (x64, x64) - and problem wasn't solved with this "pixels".
Description Im tried to use syntaxtextarea in JavaFX (v18.0.1) and got problem with fonts
Screenshots Java version Java 17 LTS
The code of JavaFX program ` import java.io.InputStream; import java.io.IOException; import javafx.geometry.Pos; import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.layout.BorderPane; import javafx.scene.layout.StackPane; import javafx.embed.swing.SwingNode; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JComponent; import javax.swing.SwingUtilities; import java.awt.BorderLayout; import javafx.scene.control.Button; import org.fife.ui.rtextarea.RTextScrollPane; import org.fife.ui.rsyntaxtextarea.TextEditorPane; import org.fife.ui.rsyntaxtextarea.Theme; import org.fife.ui.rsyntaxtextarea.SyntaxConstants; import java.awt.BorderLayout;
public class MyApplication extends Application {
} `