Which font names to sue for TrueType fonts in PS files?

Kurt Pfeifle kpfeifle at danka.de
Wed Jan 31 18:51:04 PST 2007


[Question may be a bit off-topic here, but I still hope to find someone to answer it...]

Hi,

I'm currently trying to extend my at present skin-deep knowledge about fonts and their handling in applications, PostScript + PDF files and in printing.

For this, I'm writing my own PostScript test files (or rather, a script that generates PostScript test files with that list of fonts that are handed over as parameters).

I can handle the PostScript and Ghostscript fonts fine; the names to be used are quite easy to find out.

The problem is with TrueType fonts. The question is: how do I address the font I want to use in the PS? (*

Example:
--------
In the KDE Control Center module (which you can start on itself with "kcmshell kcmfontinst" I can see a TT font named "SUSE Sans" (with variations of "Mono", "Bold", "Oblique", etc. I can run

   fc-match "SUSE Sans"

and get back

   SUSESans-Roman.ttf: "SUSE Sans" "Roman"

Fine. I know I need to look for a file named SUSESans-Roman.ttf, or I can even run

   fc-list "SUSE Sans"  file

to get back

   /usr/X11R6/lib/X11/fonts/truetype/SUSESans-BoldOblique.ttf:
   /usr/X11R6/lib/X11/fonts/truetype/SUSESans-Roman.ttf:
   /usr/X11R6/lib/X11/fonts/truetype/SUSESans-Oblique.ttf:
   /usr/X11R6/lib/X11/fonts/truetype/SUSESans-Bold.ttf:

which are the full paths. My PostScript code

   /SUSESerif-Roman findfont 14 scalefont setfont

works, and when I run "gs my_postscript.ps", Ghostscript reports in its output:

  "Loading SUSESerif-Roman font from /usr/X11R6/lib/X11/fonts/truetype/SUSESerif-Roman.ttf...
   3250660 1371473 2183648 873208 1 done."


*HOWEVER*, this does not work likewise with other TT fonts on my system. Take one that in KDE Control Center is named as "Superglue, Bold":

   kurt:~> fc-match "Superglue, Bold"
   superglu.ttf: "Superglue" "SuperBold"

   kurt:~> fc-list "Superglue" file
   /usr/X11R6/lib/X11/fonts/truetype/superglu.ttf:

But my PostScript code

   /Superglue findfont 14 scalefont setfont

yields this gs output:

   Can't find (or can't open) font file Superglue.
   Querying operating system for font files...
   Didn't find this font on the system!
   Substituting font Helvetica-Bold for Superglue.


So the first question is:
-------------------------
Which is the generic, canonic way to find out which name must be used for a TT font inside PostScript files to make sure Ghostscript finds it? (After all, fontconfig found it as well, and it is at a really standard directory for TT fonts, and it is in the same directory where the other font "SUSE Sans" was found just fine....)


The next question is:
---------------------
Given the fact that there are right now 476 *.ttf files in my /usr/X11R6/lib/X11/fonts/truetype/ directory, which other Shell utility is there to query a .ttf file for the font name it represents? (So far I'm employing "strings" and some guesswork to find out, but that's too cumbersome....)





More information about the cups mailing list