[GRASS5] iconv in d.text.freetype

Glynn Clements glynn.clements at virgin.net
Sat Mar 13 22:06:52 EST 2004

Richard Greenwood wrote:

> What is iconv and what does it do?

It converts text between different encodings (ISO-8859-*, UTF-8, etc).

> I ask because I have to #undef 
> HAVE_ICONV_H in d.text.freetype\main.c in order to compile it on my 
> version of Cygwin.

This is a known problem. It should be fixed (at least, enough for
d.text.freetype to build on Cygwin) in the current CVS version.

> Am I crippling d.text.freetype?

Without iconv support, d.text.freetype can only handle text which uses
the ISO-8859-1 encoding, or a subset of it (i.e. US-ASCII); the
charset= option will be ignored.

If you only need to display US-ASCII text, the lack of iconv support
isn't an issue.

> Am I simply missing a library?

No; the handling of the the configure checks is flawed. If you have
iconv.h, but configure fails to detect the correct library,
d.text.freetype will be compiled to use iconv, but it won't be linked
against the appropriate library so the link will fail.

In the current CVS version, the library checks have been improved such
that configure should detect recent versions of libiconv (where
iconv() is actually a macro).

The underlying problem (that d.text.freetype doesn't check for both
the header and the library) is still present. There are two
alternative solutions:

1. Make the library check define a config.h macro (e.g. 
HAVE_ICONV_LIB), and have d.text.freetype check for e.g.

	#if defined(HAVE_ICONV_H) && defined(HAVE_ICONV_LIB)

2. Make the iconv checks behave like other library checks, i.e. add a
--with-iconv switch. Without the switch, the checks wouldn't be run so
HAVE_ICONV_H wouldn't get defined, so d.text.freetype wouldn't try to
use iconv. With the switch, failure to detect either the header or the
library would be fatal.

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-dev mailing list