[GRASS-dev] font path question for Linux and Windows
glynn at gclements.plus.com
Mon Apr 30 04:34:53 EDT 2007
William Kyngesburye wrote:
> > First, we should try to come up with a list of directories which are
> > viable candidates for containing fonts.
> > The installed freetypecap file (currently just a copy of
> > scripts/d.text.freetype/freetypecap) should be generated by scanning
> > all such directories for .ttf files.
> > If browsing for font files, I would suggest starting with whichever
> > directory has the most entries in the freetypecap file.
> > BTW, with Cygwin, I would suggest starting with $WINDIR/Fonts,
> > converted to a Cygwin path, e.g. "cygpath -u $WINDIR/fonts". Windows
> > is likely to have more fonts than Cygwin.
> Note that font names on OSX aren't required to follow any file
> extension conventions. First the HFS+ file type/creator is used to
> determine if a file is a font, then the file extension if the type/
> creator are empty. I think it's that order.
> So scanning automatically for fonts to create the freetypecap may
> miss many fonts, unless it knew how to check OSX type/creator info
> for a file.
> ie the MS fonts that come with the system have no extension. Also,
> many TT fonts in OSX have been repackaged in the .dfont (a flattened
> resource-fork file).
In which case, users will need to construct the freetypecap file
The rest of GRASS doesn't care about filenames. If a name passed to
R_font() matches the first field of a line in the freetypecap file,
the second field is passed directly to FT_New_Face(). Also, if the
argument to R_font() begins with "/" and doesn't begin with (the
expansion of) "$GISBASE/fonts/", it is treated similarly.
. Er, that isn't going to work on native Windows. The line:
if (name == '/')
will need to be changed to something like:
if (isalpha(name) && name == ':' && (name == '\\' || name == '/'))
if (name == '/')
Hmm; that still doesn't handle UNC paths.
... || (name == '\\' && name == '\\') || (name == '/' && name == '/')
This is starting to get ugly.
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev