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

Paul Kelly paul-grass at stjohnspoint.co.uk
Sun Nov 25 06:47:59 EST 2007


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
?
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?

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.

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,



More information about the grass-dev mailing list