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

Paul Kelly paul-grass at stjohnspoint.co.uk
Fri May 11 10:38:25 EDT 2007

On Thu, 10 May 2007, Glynn Clements wrote:

> Paul Kelly wrote:
>> I added a structure to hold the information in the fontcap file to
>> general/g.mkfontcap/local_proto.h - perhaps it should go somewhere more
>> general to be shared with d.font.
> It needs to be available to lib/driver; as the driver.h header file
> isn't installed, I can only suggest graphics.h. Or into its own public
> header <grass/fontcap.h> (it would need to be moved to either include
> or lib/driver, so that it gets installed to $GISBASE/include before
> lib/driver is compiled).

I put it in include/freetypecap.h. Seemed the obvious place after a bit of 
poking around.

> Also, can you update lib/driver/parse_ftcap.c to use the new file, and
> change COM_Font_get() to use the type field (rather than the
> $GISBASE/fonts heuristic) to determine stroke/freetype font.

I think I've done that successfully now. Summary from CVS commit:
* Add a trailing | to fontcap format to allow for future expansion and 
make parsing easier
* Move GFONT_CAP struct to include/freetypecap.h
* Change libdriver to read the new fontcap file
* Stop tools/mkftcap generating the freetypecap file
* Change libdriver to set the encoding according to the value in fontcap

This is probably the most controversial change - not really sure what its 
implications are. Is GRASS_FT_ENCODING still available to override this 
when using direct rendering? I couldn't find it in the source code 
anywhere although it's documented in lib/init/variables.html. In d.font 
R_charset() is called after R_font() so it should override it OK. Except 
in lib/driver/font_freetype.c the default is ISO-8859-1 but in the 
generated fontcap file it is utf-8 - is that likely to cause any problems 
or unusual behaviour? It is probably good that the encoding value in 
fontcap is actually used, anyway.

* Change d.font to list only the output from R_font() and not do a 
separate search for stroke fonts

Also noticed that d.font called G_gisinit() twice - I assumed this was a 
bug and removed the second call (just before G_parser()).

* Fix gis.m to discard stderr from d.font as using R_font() seems to cause 
it to print some PNG driver messages to stderr

The font selection box in gis.m is now not as pretty (on Windows anyway, 
with the short 8-character filenames) as it only shows the short filename 
and not the full descriptive font name. But this is a minor point for now.


More information about the grass-dev mailing list