Font resource bundle or include directly

9 views
Skip to first unread message

tbeernot

unread,
Jan 2, 2016, 12:33:45 PM1/2/16
to jfxtras-dev@googlegroups.com (via tbeernot@gmail.com)
I've fixed a test issue with the gauges in labs caused by the fact that on different OSes different default fonts are used. This caused some asserts to fail. By using Google's Roboto font, I was able to have at least Linux and Windows render identically, I will test OSX soon.

I suspect more tests are failing because of the same reasons (Agenda being a very likely candidate), so I want to use Roboto there as well. But I'm in doubt what the better approach is:
1. Include a specific Roboto font directly in each jar, so jfxtras-gauges will have "Roboto medium", and Agenda probably "Roboto condensed".
2. Create a jfxtras-fonts-roboto.jar containing all Roboto fonts, Gauges and Agenda will depend on that.

1 is easier and more focused on the direct solution of the problem, but chance are that in time there will be duplicate resource files.
2 is higher on reuse, more difficult to implement, but there most likely will be unused resource files. Especially if more resource jars well be created in time.

Initially I intended to go for 2, because of the reuse (and also other project can easily use the Roboto font then), but after some time I'm starting to doubt if that is the best option and am more and more leaning towards include-what-you-need.

Any thoughts?

Tom

Gerrit Grunwald

unread,
Jan 2, 2016, 11:46:50 PM1/2/16
to jfxtr...@googlegroups.com
+1 for 2.
> --
> You received this message because you are subscribed to the Google Groups "JFXtras Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jfxtras-dev...@googlegroups.com.
> To post to this group, send email to jfxtr...@googlegroups.com.
> Visit this group at https://groups.google.com/group/jfxtras-dev.
> For more options, visit https://groups.google.com/d/optout.

tbeernot

unread,
Jan 3, 2016, 10:35:25 AM1/3/16
to jfxtr...@googlegroups.com
Well, I created a Roboto resource jar. And ran into all kind of font loading issues; JavaFX accesses fonts by their family name, but the Roboto fonts of course are all from the same family (or at least sub-families), they differ in their font name. So JavaFX makes no distinction between "Roboto Medium" and "Roboto Medium Italic". I patched that by modifying the TTF file and changing the family names to match the font name.

That done, back to the original dilemma: adding the Roboto font jar to a project adds 2.5MB. A single font file specific for a certain use is 150kb. That is why I'm leaning towards option 2.

Tom
Reply all
Reply to author
Forward
0 new messages