Printing/Font Configuration
(see also "PostScript Level 2 "base fonts" and how Ghostscript handles them" for background info.)
Create and check various font lists
We will create several lists of fonts and check if these fonts can be used for we creating documents.
Create a file listing the "35 PS 2 base fonts"
This is the list of "35 PostScript Level 2 base fonts": AvantGarde-Book AvantGarde-BookOblique AvantGarde-Demi AvantGarde-DemiOblique Bookman-Demi Bookman-DemiItalic Bookman-Light Bookman-LightItalic Courier Courier-Bold Courier-BoldOblique Courier-Oblique Helvetica Helvetica-Bold Helvetica-BoldOblique Helvetica-Narrow Helvetica-Narrow-Bold Helvetica-Narrow-BoldOblique Helvetica-Narrow-Oblique Helvetica-Oblique NewCenturySchlbk-Bold NewCenturySchlbk-BoldItalic NewCenturySchlbk-Italic NewCenturySchlbk-Roman Palatino-Bold Palatino-BoldItalic Palatino-Italic Palatino-Roman Symbol Times-Bold Times-BoldItalic Times-Italic Times-Roman ZapfChancery-MediumItalic ZapfDingbats
Run this command to create a file 35ps2fonts.list (you can copy and paste these lines if you include each one of the trailing '\' ["backslashes"]):
echo "AvantGarde-Book AvantGarde-BookOblique \ AvantGarde-Demi AvantGarde-DemiOblique Bookman-Demi \ Bookman-DemiItalic Bookman-Light Bookman-LightItalic \ Courier Courier-Bold Courier-BoldOblique \ Courier-Oblique Helvetica Helvetica-Bold \ Helvetica-BoldOblique Helvetica-Narrow \ Helvetica-Narrow-Bold Helvetica-Narrow-BoldOblique \ Helvetica-Narrow-Oblique Helvetica-Oblique \ NewCenturySchlbk-Bold NewCenturySchlbk-BoldItalic \ NewCenturySchlbk-Italic NewCenturySchlbk-Roman \ Palatino-Bold Palatino-BoldItalic Palatino-Italic \ Palatino-Roman Symbol Times-Bold Times-BoldItalic \ Times-Italic Times-Roman ZapfChancery-MediumItalic \ ZapfDingbats" \ > 35ps2fonts.list
Create a file listing the Ghostscript fonts mapping to the "35 PS 2 base fonts"
This is the list of 35 Ghostscript font names (which should map 1:1 to the respective "PostScript Level 2 base fonts"): URWGothicL-BookObli URWGothicL-Demi URWGothicL-DemiObli URWBookmanL-DemiBold URWBookmanL-DemiBoldItal URWBookmanL-Ligh URWBookmanL-LighItal NimbusMonL-Regu NimbusMonL-Bold NimbusMonL-BoldObli NimbusMonL-ReguObli NimbusSanL-Regu NimbusSanL-Bold NimbusSanL-BoldItal NimbusSanL-ReguCond NimbusSanL-BoldCond NimbusSanL-BoldCondItal NimbusSanL-ReguCondItal NimbusSanL-ReguItal CenturySchL-Bold CenturySchL-BoldItal CenturySchL-Ital CenturySchL-Roma URWPalladioL-Bold URWPalladioL-BoldItal URWPalladioL-Ital URWPalladioL-Roma StandardSymL NimbusRomNo9L-Medi NimbusRomNo9L-MediItal NimbusRomNo9L-ReguItal NimbusRomNo9L-Regu URWChanceryL-MediItal Dingbats
Run this command to create a file 35gs2fonts.list:
echo "URWGothicL-Book URWGothicL-BookObli URWGothicL-Demi \ URWGothicL-DemiObli URWBookmanL-DemiBold \ URWBookmanL-DemiBoldItal URWBookmanL-Ligh \ URWBookmanL-LighItal NimbusMonL-Regu NimbusMonL-Bold \ NimbusMonL-BoldObli NimbusMonL-ReguObli NimbusSanL-Regu \ NimbusSanL-Bold NimbusSanL-BoldItal NimbusSanL-ReguCond \ NimbusSanL-BoldCond NimbusSanL-BoldCondItal \ NimbusSanL-ReguCondItal NimbusSanL-ReguItal \ CenturySchL-Bold CenturySchL-BoldItal CenturySchL-Ital \ CenturySchL-Roma URWPalladioL-Bold URWPalladioL-BoldItal \ URWPalladioL-Ital URWPalladioL-Roma StandardSymL \ NimbusRomNo9L-Medi NimbusRomNo9L-MediItal \ NimbusRomNo9L-ReguItal NimbusRomNo9L-Regu \ URWChanceryL-MediItal Dingbats" \ > 35gs2fonts.list
List all fonts on your system
Current Linux systems use a library called fontconfig, which says this about itself: "The intention of this library is to be the central configuration interface for all applications and libraries in the system."
fontconfig includes a utility called fc-list that prints a list of all fonts found by fontconfig. You can use it to count how many fonts you have installed in a way that enables your applications to use them:
user:~> fc-list | wc -l 684
List the first 3 fonts of the complete list found:
user:~> fc-list | head -n 3 lne,Navadno,Arrunta Living by Numbers:style=Regular Dustismo:style=Regular
List the last 3 fonts of the complete list found:
user:~> fc-list | tail -n 3 Vahika:style=Italic Rina:style=Regular Tinsnips:style=Regular
Yours will most likely be different. Search for a certain pattern in the font name:
user:~> fc-list | grep -i helvetica Adobe Helvetica:style=Bold Oblique Adobe Helvetica:style=Oblique Adobe Helvetica:style=Bold Adobe Helvetica:style=Regular
Full paths to font files
List all full paths to font files on your system (as seen by fontconfig):
fc-list : file
Put the list into a file, "fc-list_:_file.list" (Why that funny filename? It helps you re-discover which command created the file, because in a few weeks you'll have forgotten it...):
fc-list : file > fc-list_:_file.list fc-list : file | tee fc-list_:_file.list
List all fonts that support German ("de"), Turkish ("tr"), Japanese ("jp"), Korean ("ko") and Chinese ("zh") language charsets? Try these commands:
fc-list :lang=de fc-list :lang=tr fc-list :lang=jp fc-list :lang=ko fc-list :lang=zh
Check a few fonts individually
fontconfig includes a utility called fc-match that prints out what fontconfig thinks is the "best" match for a requested font name.
Example: Run this command (case of font name should not matter):
user:~> fc-match arial
Look at its output:
arial.ttf: "Arial" "Regular"
This looks OK. Now try these (output of my system included):
user:~> fc-match "courier" cour.pfa: "Courier" "Regular" user:~> fc-match "comic sans ms" comic.ttf: "Comic Sans MS" "Regular"
Last, try it with a wrongly spelt font name:
user:~> fc-match "comic ms sans" arial.ttf: "Arial" "Regular"
My system uses Arial, yours may be setup for something completely different. Yours may have used a different one even for one of the previous tests, if...
- ...either the requested font is not at all available on your system,
- ...or if your fontconfig is not set up correctly or is a buggy version.
Two more examples which are instructive (for *my* system -- yours may be different!):
user:~> fc-match helvetica n019003l.pfb: "Nimbus Sans L" "Regular" user:~> fc-match "adobe helvetica" helvR12-ISO8859-1.pcf.gz: "Adobe Helvetica" "Regular"
fc-match can be run with an additional parameters:
user:~> fc-match --help usage: fc-match [-svV?] [--sort] [--verbose] [--version] [--help] [pattern] List fonts matching [pattern] -s, --sort display sorted list of matches -v, --verbose display entire font pattern -V, --version display font config version and exit -?, --help display this help and exit
Let's try one now:
user:~> fc-match --verbose "adobe helvetica" Pattern has 26 elts (size 32) family: "Adobe Helvetica"(s) style: "Regular"(s) slant: 0(i)(s) weight: 80(i)(s) width: 100(i)(s) size: 12(f)(s) pixelsize: 12(f)(s) foundry: "Adobe"(s) antialias: FcTrue(w) hintstyle: 3(i)(w) hinting: FcTrue(w) verticallayout: FcFalse(s) autohint: FcTrue(w) globaladvance: FcTrue(s) file: "/usr/X11R6/lib/X11/fonts/75dpi/helvR12-ISO8859-1.pcf.gz"(s) index: 0(i)(s) outline: FcFalse(s) scalable: FcFalse(s) dpi: 75(f)(s) rgba: 5(i)(w) scale: 1(f)(s) charset: set(s) lang: aa|ast|ay|bi|br|ch|[....]|yap|zu(s) fontversion: 0(i)(s) fontformat: "PCF"(s) embeddedbitmap: FcFalse(w)
This means: if you are looking for the actual filename (and its path) that contains a certain font called by name (example: "verdana"), run this command:
user:~> fc-match --verbose "verdana" | grep file:
In my case, I get this line in return:
file: "/usr/X11R6/lib/X11/fonts/truetype/verdana.ttf"(s)
Check your system's "font matching" setup for lists of fonts
Above, we created the two files 35ps2fonts.list and 35gs2fonts.list. Let's check if each of the names contained in these files are found by fontconfig, or if it sometimes uses some default font instead.
First, to check the matches for the list of "official" PostScript font names, run this command (output appears on screen and is saved to the file ps2fonts.matches at the same time):
for i in $(cat 35ps2fonts.list); do \ echo "$i :"; \ echo -n " "; \ fc-match $i; \ echo; \ done \ | tee 35ps2fonts.matches
Next, check the matches for the list of Ghostscript alias names (output will be saved to gs2fonts.matches):
for i in $(cat 35gs2fonts.list); do \ echo "$i :"; \ echo -n " "; \ fc-match $i; \ echo; \ done \ | tee 35gs2fonts.matches
Now that you have the list of the most important matches in the two files (35ps2fonts.matches and 35gs2fonts.matches), scan it for any outstanding mis-matches of requested and received names. Should you find such mismatches -- these are the ones that...
- ...will not print as intended,
- ...will not embed in PDFs as intended,
- ...will not be properly usable in applications like KWord,
- ...will need fixing before you can use them full.