<AWT Dev> Request: Loading physical TrueType fonts fails due to missing name records in otherwise valid TTF files

Nate Smith nathan at neocortical.net
Wed Jan 22 12:57:01 PST 2014


I encountered some issues loading physical fonts from file on my system,
resulting in FontFormatException: Font name not found.

I traced these back to sun.font.TrueTypeFont#initNames(), which takes a
rather strict approach to populating the familyName and fullName fields for
a Font instance, both of which are required to be non-null in the init()
method. Notably, initNames() ignores any name records with a platform ID
other than Microsoft (MS_PLATFORM_ID).  This makes any font file that only
contains Mac OS name records unloadable.

Two possible (complimentary) fixes:

   1. Inspect name records for platforms other than Microsoft.
   2. Generate default names (based on file name, user-supplied, etc.) when
   a valid name record cannot be found

Thoughts?

Cheers,
nate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20140122/335ea7bd/attachment.html 


More information about the awt-dev mailing list