Skip to main content

Is it possible to add a new TTF font into OpenJFX list of supported fonts

1 reply [Last post]
obourdon
Offline
Joined: 2005-10-18
Points: 0

seems like when I call new Font("TTFTestFont", "PLAIN", 14);
the underlying code just looks into a hasmap to find the font family and
if not found just creates the font but maps it to a default font of some sort with
throwing any error or exception

Furthermore tracing the process with strace on linux, there do not seem to be any call to open my TTFTestFont.ttf file

Any clues ?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
coffeejolts
Offline
Joined: 2007-05-17
Points: 0

Since Java 1.3, it has been possible to create a font from a stream. And, the JavaFX api provides a Font.fromAWTFont(f: java.awt.Font ) method. So, create the awt font from the file, then create the JavaFX Font from the awt one.