Description
FXD provides support for a "Font.fontFromURL" method, but JavaFX itself only supports looking up fonts via the font-family name method, which is broken on all platforms.
Why is it broken? Well, the same font file, one different oses, can have a different name. There is no standard for building a font-family name from internal font info.
On macs, the font family-name returned for a system-font could be "Foo Regular Bold" and on Windows "Foo-Bold Regular". I have seen this behavior across Linux vs Windows and Mac. The font libraries for all three systems will provide differing font-family names for the same font. This makes fonts unportable. Also, the family name returned for a font installed on the system can differ from the font family name that Java comes up with loading a font from its own local font directory.
The only way to GUARANTEE you get the font you are asking for is to directly load the TTF file.
Why is it broken? Well, the same font file, one different oses, can have a different name. There is no standard for building a font-family name from internal font info.
On macs, the font family-name returned for a system-font could be "Foo Regular Bold" and on Windows "Foo-Bold Regular". I have seen this behavior across Linux vs Windows and Mac. The font libraries for all three systems will provide differing font-family names for the same font. This makes fonts unportable. Also, the family name returned for a font installed on the system can differ from the font family name that Java comes up with loading a font from its own local font directory.
The only way to GUARANTEE you get the font you are asking for is to directly load the TTF file.
Attachments
Issue Links
- duplicates
-
JDK-8106836 Document how to embed fonts in FX apps
- Closed