[GRASS-dev] setting 'default' font

Glynn Clements glynn at gclements.plus.com
Tue Apr 24 04:21:20 EDT 2007

Michael Barton wrote:

> I¹m thinking about making a convenience default setting dialog for GRASS in
> the wxPython GUI. It would simply let users select a TT font (Do I need to
> have an option for a stroke font too?).

It would be wise to allow stroke fonts to be selected, as they will
always be available. The set of available stroke fonts can be obtained
by listing $GISBASE/fonts/*.hmp.

> This font would then be set at
> render time using the GRASS_FONT environmental variable.

With FreeType fonts, you also want to set GRASS_FT_ENCODING. If this
isn't set, it defaults to ISO-8859-1 (this is hard-coded if built
without iconv).

Unless Python provides a better way, you may be able to get the
locale's encoding[1] using the command "locale charmap".

[1] I'm presuming that's what Python uses when passing strings to the
child's argv[] or stdin.

> Is there any way to set the size for the font (e.g., for legends and
> scalebars where you can¹t select a size)? Or is it just a font name?

No, modules have to set the text size themselves. It is initially zero
(and, with a standalone driver, persists between clients), so modules
which draw text always set it explicitly (whether from an option, a
calculation based upon the amount of text being drawn and the size of
the screen, or a hard-coded constant).

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list