[GRASS-dev] figureing out fonts - part 3 correction

Glynn Clements glynn at gclements.plus.com
Tue May 1 05:22:54 EDT 2007

Hamish wrote:

> > The mkftcap script will generate a freetypecap file containing all
> > .ttf files found in its hard-coded list of directories. The user may
> > subsequently edit the file.
> patch attached, for your consideration.
> (run without needing a fake mapset, add copyright and file header)

The $GISBASE test was needed when it wrote to
$GISBASE/etc/freetypecap, but is no longer required.

> Can "^*" be added to promote a consistent non-romans default font (if
> found)? eg. Helvetica, Vera, or something common (sans).

I would rather leave it to the user to set GRASS_FONT in their
~/.grass.bashrc etc.

> How well does it deal with spaces in font path names?

It seems to work okay. Certainly, it handles spaces in the filenames;
I don't have any fonts in directories which have spaces.

> > For binary distributions, the mkftcap script will need to be run on
> > the target system after installation, or the user will need to create
> > the file by other means.
> shall we add the running of the script to this part of lib/init/init.sh
>   # First time user - GISRC is defined in the GRASS script
>   if [ ! -f "$GISRC" ] ; then
>     ...
> and add a rescan button to Michael's new GUI default font picker tool?

The user may not be able to modify the system-wide freetypecap file
due to filesystem permissions.

The "right" place to generate the global freetypecap file is either at
build time (when building from source) or from a post-install script
(when installing a binary package).

Also, I consider the freetypecap file to be a configuration file. 
Auto-generation is useful for a quick start, but once the file exists,
it should only be modified by the user.

> > Any fonts which are added after the freetypecap file is created won't
> > appear until the file is explicitly updated.
> for this we could add a hint in the d.font help page to run
> "$GISBASE/etc/mkftcap" from the GRASS prompt.

It's actually in the scripts directory at the moment.

> > IOW, there can be fonts which are installed but which aren't listed in
> > the freetypecap file. This may be an explicit choice on the user's
> > part, or it may be an oversight. If you could guarantee that all fonts
> > were listed in that file, there wouldn't be any need to support
> > specifying fonts by an absolute path.
> so Michael's new GUI font picker tool could have three entries:
> //////////////////
> // <> stoke font [pulldown list of the usual suspects]
> // <> (registered) TTF [pulldown list parsed from freetypecap] [Rescan]
> // <> Browse filesystem for TTF file
> //
> // Selected font: [____]    [Set as Default]
> /////////////////

Sounds reasonable.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list