[GRASS-dev] font path question for Linux and Windows
Glynn Clements
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
manually.
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 "/"[1] and doesn't begin with (the
expansion of) "$GISBASE/fonts/", it is treated similarly.
[1]. Er, that isn't going to work on native Windows. The line:
if (name[0] == '/')
[lib/driver/Font.c:27]
will need to be changed to something like:
#ifdef __MINGW32__
if (isalpha(name[0]) && name[1] == ':' && (name[2] == '\\' || name[2] == '/'))
#else
if (name[0] == '/')
#endif
Hmm; that still doesn't handle UNC paths.
... || (name[0] == '\\' && name[1] == '\\') || (name[0] == '/' && name[1] == '/')
This is starting to get ugly.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list