[XeTeX] Finding the right font family name
Barry MacKichan
barry at mackichan.com
Wed Dec 5 00:33:56 CET 2007
We are developing a product that will use XeTeX at the back end. We want to let
the user choose a font by selecting it from a menu containing all the installed
OpenType and TrueType fonts.
We just purchased Adobe's Garamond Premier Pro font set, and otfinfo tells me it
has several different names:
Family: Garamond Premier Pro
PostScript name: GaramondPremrPro
Mac font menu name: Garamond Premr Pro.
XeTeX seems to accept the family name and the PostScript name (which is a font
name, not a family name), but not the Mac font menu name. Since the family name
is the only one that is invariant across all the variations in the font, this is
the one we want.
The problem is that the menu that we get (on Windows the name we get is the only
name in the LOGFONT structure, which supposedly holds all the information that
Windows has about a font) displays only the Mac font menu name, not the family
name. I don't know the details on the Mac, but presumably the same is true since
the menu we get shows only the Mac font menu name.
The question is: how do we get at the font's Family name when Windows is
returning only the Mac font menu name? Many fonts don't have a Mac font menu
name, and so there doesn't seem to be any problem with them. Since the user
can't be expected to know any more about the font name than appears in the menu,
we really need to solve this problem. Does anybody have a workaround (other than
maintaining a file that maps one type of name to the other?). There are usually
more than 200 fonts in the list, so going to the disk to find the family name is
too time-consuming.
On another note, when the corrent family name is given to XeTeX, there are a
number of 'Arithmetic overflow' errors, but the resulting PDF looks OK. Is this
a known problem?
--Barry MacKichan
More information about the XeTeX
mailing list