[GRASS-dev] 6.3.0 release - need to set default font

Michael Barton michael.barton at asu.edu
Sun Nov 25 10:53:56 EST 2007


Paul,

You've ID'ed the proximate cause of the problem. See below.


On 11/25/07 4:47 AM, "Paul Kelly" <paul-grass at stjohnspoint.co.uk> wrote:

> On Sat, 24 Nov 2007, Michael Barton wrote:
> 
>> I'm pretty sure that this was discussed briefly, but cannot find it in the
>> dev archives.
>> 
>> Sometime recently (past couple months), I've ended up without any default
>> font for GRASS in versions I compile, and have to set a font before I have
>> any text with barscales, legends, and the like.
>> 
>> The new TrueType font capabilities are great and much nicer than the old
>> default stroke fonts, but we should have *something* set as a default font
>> when GRASS starts up. This is a problem on Mac and Windows builds but may
>> not be showing up on Linux builds.
> 
> Does the problem go away if the fontcap file is regenerated:
> g.mkfontcap -o
> ?

Yes

> If so, this would be an issue with the install procedure not generating
> the fontcap file to match the local system and the installation location
> of GRASS. But I think there is more to it than that. I seem to remember
> someone said was the problem was *not* that romans wasn't being set as the
> default, but that there wasn't a properly matching entry for it in the
> fontcap file. What does
> d.font -L | grep romans
> say?

Prior to re-running g.mkfontcap, it comes up blank.

> 
> In general for actually using the fonts, if the path to the stroke fonts
> given in fontcap is wrong, it doesn't matter, as the library code
> currently ignores it and reconstructs the path based on the current
> GISBASE. However, the code that scans the fontcap checks the path given
> for each font there to see if it exists, and skips it if not, so I suspect
> that might be where the problem is. If so, re-running g.mkfontcap to
> generate the proper paths should fix it. As should the following patch
> (untested) but that is a bit of a hack and I would prefer the issue to be
> resolved by making sure the fontcap is current.

What is the best way to do this?

Also, where is the GRASS default font set to Romans?

Now that we have a system-wide fontcap, that normally would include nice
TrueType fonts, wouldn't it be better to first try to default to a TrueType
font and drop back to Romans only if that font couldn't be found?

e.g., whatever sets the default font first looks to see if a GRASS_FONT
variable is set in .grassrc6. If not, it scans fontcap for Helvetica, Vera
sans, Ariel, or some such nice san-serif TrueType font. If a font on a
restricted list of likely fonts is not found, it then defaults to the Romans
stroke font.

Michael




> 
> Paul
> 
> Index: lib/driver/parse_ftcap.c
> ===================================================================
> RCS file: /grassrepository/grass6/lib/driver/parse_ftcap.c,v
> retrieving revision 1.5
> diff -u -r1.5 parse_ftcap.c
> --- lib/driver/parse_ftcap.c    11 May 2007 14:22:07 -0000      1.5
> +++ lib/driver/parse_ftcap.c    25 Nov 2007 11:47:21 -0000
> @@ -56,7 +56,9 @@
>                                    != 6)
>                                  continue;
> 
> -                       if (!font_exists(path))
> +                       /* Don't check the path for stroke fonts as we
> reconstruct it
> +                        * from $GISBASE and don't need it to be correct here
> */
> +                       if (type != GFONT_STROKE && !font_exists(path))
>                                  continue;
> 
>                          fonts = (struct GFONT_CAP *)G_realloc(fonts,
> 

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton




More information about the grass-dev mailing list