[gs-devel] new fontmap utility
ray at artifex.com
Mon May 13 08:54:36 PDT 2002
Thanks for your thinking on this. Sorry for the delayed response --
I was on a business trip Thur and Fri and Sat and Sun were taken
up with Mother's Day.
I've long been concerned that the use of GS_FONTPATH, while handy,
can really be slow on a system with lots of fonts (my Windows
system has 537).
What would you think about changing Ghostscript so that it would
create a local Fontmap supplement when it scans the GS_FONTPATH
The option would be enabled by specifying a GS_SCANNED_FONTMAP
environment variable and/or -sGS_SCANNED_FONTMAP=... command line
option. If this variable is defined, then that file would be
written with any fonts found during the scanning process. As
now, the scanning would only be performed when a font is used
that is not in the normal Fontmap or already in GS_SCANNED_FONTMAP.
Thus this offers a sort-of 'incremental compile' approach. The
file would be created and updated as needed. Any files present
in the GS_SCANNED_FONTMAP would not need to be opened during
the enumeration of the GS_FONTPATH directories during a (rare)
If a file given in GS_SCANNED_FONTMAP is not found when trying
to load a font, then that entry would be removed from the
fontmap and the scan would be performed (prior to substitution
One of the advantages is that the existing logic works on all
platforms and picks up all font types including TTF, so we
would be able to use all fonts without the high overhead.
Artifex Software Inc.
> Hi there
> Thanks for your consideration. I'm, by the way not trying to sell something, here :-)
> I simply thought that GS related tools should be available in that environment
> rather than somewhere in the wild. Actually, it didn't even come to my mind to
> see it included in the GS distribution athough I'm pleased to see that considered.
> Four points, that I feel should bee seen/considered:
> - As Peter correctly states, GS does have very similar capabilties built in.
> But, if I may take myself as average (as opposed to professional or newbie)
> example: I *did* look through the excellent GS documentation but I did it
> with the eyes of a non-expert and it didn't strike me that my problem (to
> have GS know about type1 font outside of its directory) was already solved.
> - Googleing for that problem (e.g. ghostscript fonts adding) brought up
> a whole lot of other people with the same or very similar problems. This
> is, with all respect, not the only case where GS provides a nice service
> many (most ?) users don't know about. I remember myself editing "fonts.dir"
> because I thought it was necessary for GS rather than simply being a courtesy
> towards X.
> Again: This is somewhere in the documentation. But, how many network engineers,
> secretaries, book-keepers will read the whole vast documentation of something
> they consider as part of the printer driver and not as an application they
> actually work (interact) with ?
> - We shouldn't underestimate the "interpreter" vs "compiler" issue, i.e. scanning
> all those directories at each GS start vs. having it done once. Let us not forget
> that GS, unlike e.g. Gimp, isn't an application that we keep open on our desktops
> but rather something that might well come up dozends of times a day.
> - Unlike Peter I don't see a tool like gsfontmap as a potential hassle for
> admins (I happen to be one :-) but as a plus. Font-providers or admins would
> have a simple and predictable way to include it in their font-packs (installation
> scripts). In fact, I personally plan to include it in our inhouse Linux
> distribution in order to have the usual font locations (staroffice, X, ...)
> automatically resolved and to have a simple way to add our standard set
> of fonts.
> For fairness sake: gsfontmap does *not* support TTF and does probably *not*
> (nor plan to) support Windows. It would need considerable friendly forces
> persuading me into doing that.
> It might interest you that I plan to enhance gsfontmap in three ways:
> - I will make it look for doublettes (x, e.g. adds a second Courier)
> - I will make it generate aliases. Staroffice, for example, seems to
> generate PS with FontNames that use a lot of '_' underscores. (e.g.
> "/Courier_Bold" instead of "/Courier-Bold")
> - I will make it list all available Families, possibly with styles.
> Thanks for your interest
> Ramon Mall
> rmm AT cynexus.net
> -- Want to be secure ? Close your Windows ! --
> On Sat, 11 May 2002 07:37:13 -0700
> "L. Peter Deutsch" <ghost at aladdin.com> wrote:
> > > You call it something like "gsfontmap.py /foo/bar/16tons/*.afm" and it
> > > outputs the proper Fontmap.GS lines (along with a little comment header
> > > and finally a success line (to stderr))
> > This is a nice utility. However, Ghostscript already has a built-in
> > facility for doing something very similar. If you set GS_FONTPATH to a list
> > of directories, Ghostscript will scan those directories for .pfa, .pfb,
> > .ttf, and other recognized font formats, and will build the equivalent of
> > the Fontmap dynamically. This has been implemented for many years and is
> > documented in doc/Use.htm.
> > The tradeoff is that GS_FONTPATH does require scanning the directory, and
> > does require opening each possible font file to make sure that it is, in
> > fact, a font file. Ghostscript does this only once per run, and only if it
> > can't find a requested font using the Fontmap, but it does take some time.
> > Generating a Fontmap in advance is obviously more efficient, but the user or
> > system administrator must remember to run the utility whenever a font is
> > installed or uninstalled.
> > --
> > L. Peter Deutsch | Aladdin Enterprises | 203 Santa Margarita Ave.
> > ghost at aladdin.com | http://www.aladdin.com | Menlo Park, CA 94025
> > No government censorship of software! Oppose the CBDTPA! www.eff.org
> gs-devel mailing list
> gs-devel at ghostscript.com
More information about the gs-devel