[GRASS-dev] font path question for Linux and Windows

Glynn Clements glynn at gclements.plus.com
Tue May 1 01:49:51 EDT 2007

William Kyngesburye wrote:

> >> - Maybe Michael's proposed font path env var could be used here?  For
> >> additional user font paths to search automatically.
> >
> > I can add "$@" to the list used by mkftcap, so other directories can
> > be passed as arguments. Environment variables are problematic when
> > directories contain spaces, but command-line arguments can be quoted.
> If it uses a colon-separated list like other path env vars do, can't  
> it be split that way, and then each item quoted in the loop?  My  
> shell scripting isn't very good to know.

The shell's string processing facilities are actually pretty poor. 
Trying to do anything non-trivial gets ugly quite quickly.

> >> - since this is now in /tools and installed in etc/, that implies
> >> that mkftcap will get run automatically somehow?  From GUI?  Or some
> >> future script module?  On startup?
> >
> > At present, it gets run at build time; thereafter, it has to be run
> > manually. It could be run from a post-install script used by the
> > packaging system (.deb, .rpm, etc).
> >
> > It isn't intended to be run automatically during normal use.
> What about at startup time?  Users may want to manage fonts in  
> between runs of GRASS, so the available fonts can change often.

Ultimately, the freetypecap file is meant to reflect user preference;
it isn't a cache of all fonts which are present on the system, which
is why R_font() also allows a complete path to be used in place of a
font name.

Users with many fonts may only want the most common ones to appear in
any option lists.

> >> - regenerating the freetypecap at runtime in the GRASS application
> >> folder is not a good thing on OSX (see my previous discussions about
> >> OSX apps and user preference/config/addon files).  There should be
> >> some way to have GRASS look for alternative external freetypecap
> >> files, for both generating the freetypecap file, and reading it to
> >> set the font.
> >
> > The code which reads the file already uses $GRASS_FT_CAP if that is
> > set.
> I missed GRASS_FT_CAP - how recent is this?

$GRASS_FREETYPECAP was added to d.text.freetype on 2002/05/30, and it
still uses that name. It was added to d.font.freetype when freetypecap
support was added on 2004/10/28.

$GRASS_FT_CAP has been used since the FreeType support was merged with
the driver's existing font handling on on 2006/09/01.

Note that d.{text,font}.freetype are no longer compiled; they have
been replaced by scripts which call d.text.new and d.font
respectively. d.text.new and d.font both use R_font(), which uses the
driver's built-in FreeType support, so $GRASS_FREETYPECAP is no longer

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list