1

I've finished my JavaFx application and compiled the program. However, my application uses a font from "Apple". When I opened the application on a different OS like my Windows 10 PC, the font was completely different and the things such as buttons and text labels were too long that is created ellipsis ("..."). Is there a way I can transfer fonts over, or force the application to only run under a certain font?

Thanks in advance.

Bruce219
  • 37
  • 2
  • 11
  • If you use reasonable choices for your [layout](http://docs.oracle.com/javase/8/javafx/layout-tutorial/builtin_layouts.htm#JFXLY102), it should work no matter what font is used to display the text. – James_D Mar 08 '17 at 13:39
  • I use the font Apple SD Gothic Neo, and it shows as it is on mac os devices. It however, shows a different font design on Windows OS, so I don't see how layouts will keep the fonts from changing, please elaborate. – Bruce219 Mar 08 '17 at 13:46
  • It won't keep the font from changing. The layout will adjust to the font currently in use, so there is enough space to display the text whatever the font. (Fixing a font is *very* bad practice - e.g. if a user had poor vision and had set their system font to something large, if you forced them to use a font to fit your non-flexible layout your app becomes unusable for them.) – James_D Mar 08 '17 at 13:50
  • I see, that's quite true I guess, but if I insist, is font fixing for different OS hard to do? If not, how'd you go by doing so. – Bruce219 Mar 08 '17 at 14:03
  • I guess you could bundle a custom font with the application, and use it as the font for the entire application. I haven't used custom fonts, but AIUI you can see this globally in your CSS file for the application. – James_D Mar 08 '17 at 14:06

1 Answers1

0

How about setting your controls (buttons,labels etc) to use a safe font family (as described by ampsoft.net and referenced in this question) in your CSS file?

For example:

.button{
-fx-font-family:'serif';
}

.label{
-fx-font-family:'serif';
}
Community
  • 1
  • 1