[GRASS-dev] iconv a required dependency for using Freetype?

Glynn Clements glynn at gclements.plus.com
Sun May 6 11:20:56 EDT 2007

Paul Kelly wrote:

> > FWIW, the robust way to check whether two paths are equivalent is to
> > stat() (or lstat()) both of them, and check whether the device and
> > inode numbers match.
> Interesting; here we are comparing the directory the fonts are stored in 
> rather than the font files themselves but perhaps still of use?

Yes; in the case of COM_Font_get(), you would need to remove the last
part of the path and check whether the directory part refers to the
same device/inode as $GISBASE/fonts.

> > That handles all of the different ways that you can make multiple
> > paths refer to the same file/directory (case sensitivity, symlinks,
> > hard links, mount points, use of . and .., etc).
> >
> > However, I don't know whether it works on Windows, i.e. whether the
> > device/inode numbers are meaningful.
> >
> [...]
> >
> > parse_freetypecap() is called from LIB_init(), in lib/driver/init.c.
> > For direct rendering, this is called from LOC_open_driver(); for a
> > standalone driver it's called from main().
> >
> > Also, I'd guess that using a colon as the field separator is likely to
> > be problematic on Windows.
> Yes, that was it. If I use a semi-colon instead all works great - maybe we 
> could change mkftcap to generate a file with semi-colon separators? And 
> change parse_freetypecap() to handle both for backwards compatibility? Is 
> the last character on a line in freetypecap always a separator character? 
> If so that would be a quick way to check. Or could scan the first line and 
> whichever appeared first between : and ; use that as the separator?

If it's going to be changed, one option is to use a vertical bar
(which isn't a legal filename character on Windows), and make the face
index a separate column.

That would eliminate the possibility of using a non-zero index when
specifying a font by a pathname, but that's problematic for other
reasons (e.g. gisprompt = "old_file,..." should probably check for
file existence, which would rule out the option of using something
which is "almost" a filename).

AFAIK, the trailing separator is an artifact of the time that style
information (colour, size) was included in the freetypecap file.

BTW, the encoding field isn't used either (d.font.freetype and
d.text.freetype used it, but the driver doesn't).

Note that d.font has code which parses the freetypecap file in order
to generate the option list for font=, and to implement the -l switch,
so that will need to be updated if the format changes.

d.font.freetype and d.text.freetype have similar code, but they no
longer need to be maintained; they have been replaced by scripts which
call d.font and d.text (which is actually d.text.new) respectively.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list