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

Glynn Clements glynn at gclements.plus.com
Sun May 6 05:34:17 EDT 2007

Paul Kelly wrote:
> On Sat, 5 May 2007, Glynn Clements wrote:
> I've attached a diff of a few more changes I'm considering making, mostly 
> relating to path and filename handling for Windows compatibility in 
> loading fonts. Here's what I've changed so far:
> lib/driver/Font.c, COM_Font_get():
> * Cross-platform check for absolute path (new gislib function added)
> * Check for pathname matching the GRASS stroke fonts made more robust by
>    (a) First converting all directory separator characters to '/'
>    (b) Doing a case-insensitive comparison

That last point is probably safe, in that you're unlikely to have
another directory which differs only in case on Unix.

Although, in this case, I'd be inclined to simply remove the option to
specify a stroke font using a full path. Personally, I doubt that this
feature would ever be used.

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.

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.

> I haven't committed the changes yet as they're not complete. Apart from
> being unsure about stripping off the .hmp extension, specifying a
> font in GRASS_FONT from the freetypecap file doesn't work. I'm just
> testing this from the command line on Windows, i.e. using direct
> rendering as drivers don't work, and I can't see where/if the freetypecap 
> file is actually being read. Specifying the full path to a Freetype font
> works fine, but is the freetypecap file only read when a driver process
> is initialised?

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.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list