[Fontconfig] On PS FontName

James Cloos cloos at jhcloos.com
Wed Feb 24 14:56:38 PST 2010

>>>>> "B" == Behdad Esfahbod <behdad at behdad.org> writes:

B> I was wondering if anyne can point me to the canonical way to form the PS
B> FontName from a Fontonfig pattern.  A quick search didn't get me anywhere.

There isn't one, given that fc does not cache the PS fontname.

That said, apps which know a PS FontName and want to use fc to try and
find that font on the filesystem will likely split on the last '-', use
everything before that hyphen as a name and attempt to parse what comes
after into width/weight/slant.

Doing that in reverse will work for many fonts, but not for all.
Several fonts use abbreviations w/in the ps name because of the
31 character maximum length.

To do it from a shell script, as things stand, I would use fc-match to
get the filename and pass that to otfinfo -p (from lcdf typetools) to
recover the psname.  Or, if the file is a type1 I'd pass it to t1ascii
and parse the result for /FontName.

Only if fc were to cache the /FontName from type1 dicts and the
TT_NAME_ID_PS_NAME from SFNTs could apps search for that and get
back a full pattern.  Whether splitting off width/weight/slant
still should be required is an interesting question.

James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6

More information about the Fontconfig mailing list