[GRASS-dev] how to set fonts for d.text.new

Huidae Cho grass4u at gmail.com
Wed Sep 20 15:22:06 EDT 2006


On Wed, Sep 20, 2006 at 11:40:00AM -0700, Michael Barton wrote:
> 
>    I’d like to put d.text.new into the GUI layer toolbar, since it now combines GRASS and freetype fonts, and works on all platforms as far as I can tell.
>    To make life easier for users, my plan is to allow them to also set the font in the same options panel. Give the discussions of a few weeks back that I sort of followed, this leaves me with several questions about how to do this in an easy, useful way, that doesn’t mess up other things.
>    Currently, d.font and d.font.freetype offer a non-interactive entry widget for typing in a font name and path. TclTk offers a built-in font selection dialog that I’ve used in some other modules (thematic mapping legends, PS text) that lets a users interactively select system fonts. Will these work with d.text.new? I’ll also leave it so that a user can type in something if they want.

If the system font is a FreeType font, you can pass the path to d.font
so that d.text.new can pick it up later for drawing.  However, for
immediate rendering currently used by gis.m, you may need to set
GRASS_FT_FONT, GRASS_FT_ENCODING, GRASS_FONT environment variables
since, AFAIK, d.font(.freetype) has nothing to do with immediate
rendering (they don't set font related env vars).

>    Which is better to use for setting fonts in this way: d.font or f.font.freetype?

d.font has been already merged with d.font.freetype, so TclTk code for
d.font should work with this new implementation. But again, it works
only for monitors.

>    What will happen in the GUI is that d.font.freetype (or d.font) will run, followed by d.text.new. Will this affect the fonts in all subsequent layers (e.g., for legends)? If so, how can I put the font back to the way it was before running the font/text layer?

Save the above environment variables, display text, and restore previous
font settings?

Huidae

>    Thanks
>    Michael
>    __________________________________________
>    Michael Barton, Professor of Anthropology
>    School of Human Evolution & Social Change
>    Center for Social Dynamics and Complexity
>    Arizona State University
>    phone: 480-965-6213
>    fax: 480-965-7671
>    www: [1]http://www.public.asu.edu/~cmbarton
> 
> References
> 
>    1. http://www.public.asu.edu/~cmbarton

> _______________________________________________
> grass-dev mailing list
> grass-dev at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev




More information about the grass-dev mailing list