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

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.

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

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?

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: http://www.public.asu.edu/~cmbarton

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@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

Thanks. This is helpful.

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: http://www.public.asu.edu/~cmbarton

From: Huidae Cho <grass4u@gmail.com>
Date: Wed, 20 Sep 2006 14:22:06 -0500
To: Michael Barton <michael.barton@asu.edu>
Cc: GRASS developers list <grass-dev@grass.itc.it>
Subject: Re: [GRASS-dev] how to set fonts for d.text.new

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@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

Huidae Cho wrote:

> Ie$(C!/e(Bd 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 doesne$(C!/e(Bt 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 Ie$(C!/e(Bve 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? Ie$(C!/e(Bll 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?

If you're using immediate rendering, you need to use the environment
variables mentioned above. This will affect the default font in all
modules.

I suggest providing a global setting for these variables, as well as
allowing it to be overriden on a per-command basis.

Since R_font() was extended to support both stroke and FreeType fonts,
GRASS_FT_FONT is essentially redundant; you can use GRASS_FONT for
either. The value of $GRASS_FONT can either be the full path to a
(stroke or FreeType) font file, or the name of any FreeType font in
the $GISBASE/etc/freetypecap file, or the name of any stroke font in
$GISBASE/fonts.

With immediate rendering, the driver's state is completely reset at
the beginning of each d.* command, so state-setting commands (e.g.
d.font, d.frame) are meaningless when using immediate rendering.

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

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.

Before we go to far with d.font.new I think we should rename it.
After a short time the name will become an anachronism.

If it can act as a drop in replacement for d.font (+ new options), we
should rename it in the Makefile to be d.font and drop the old one(s).
If not, perhaps name it d.font2 or something?

Hamish