[GRASS-dev] Re: [GRASS-user] Freetype fonts in gis.m

Glynn Clements glynn at gclements.plus.com
Mon Jun 12 07:32:36 EDT 2006


Michael Barton wrote:

> >> More generally, to make the d.* commands most efficiently useable from
> >> the command line and for scripting, it makes sense to add a font=
> >> option to all that need it. That is, d.legend by itself should be able
> >> to set which font it uses. It can already set everything else except
> >> the font.
> > 
> > The question remains how to easily retain a font setting if the display
> > monitors will be stateless. From the command line having to retype it
> > for every module is highly annoying. Right now I just need to set my TTF
> > font once per session.
> > 
> > * I want to be able to set a default font. (optionally TTF)
> > * I want to keep the modules as simple as possible. (e.g. d.vect+new user)
> 
> You should also be able to set a 'default' font. The font= argument should
> be optional. If left out of the command, it defaults to the default font.
> The default font could be set (as now) with d.font*

The main problem is that, currently, there is exactly one way to set
the font: R_font().

[Or R_font_freetype(), which behaves similarly, but selects a FreeType
font. There is only one current font, which can be either vector or
FreeType.]

The same calls are used both by d.font[.freetype] and by any program
which sets the font for its own text rendering (e.g. d.text, d.vect). 
d.font relies upon the fact that the setting persists, while other
programs don't care about the fact that the setting persists.

Changing d.font[.freetype] to use a different mechanism (e.g. $GISRC)
will break the existing behaviour, whereby you can set a different
font on each monitor. I don't know how important it is to retain this.

If we are willing to discard that, what needs to be done is to:

1. Make the driver reset the current font based upon $GISRC at each
client connection.

2. Change d.font[.freetype] to modify $GISRC rather than using
R_font().

If we need to preserve the behaviour of each driver having its own
current font, then what needs to be done is to:

1. Extend the library, protocol and drivers to provide separate
functions for setting the current and default fonts. [The $GISRC
approach will suffice for the driver-less rendering case.]

2. Change the drivers to reset the current font to the default font at
each client connection.

3. Change d.font[.freetype] to use the new functions for setting the
default font.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list