[GRASS-dev] figureing out fonts - part 3 correction

Michael Barton michael.barton at asu.edu
Mon Apr 30 16:15:16 EDT 2007


Thanks for the ideas. To clarify, will the fonts be listed in $GRAS_FT_CAP
such that I can just parse this?

Michael


On 4/30/07 12:27 PM, "Glynn Clements" <glynn at gclements.plus.com> wrote:

> 
> Michael Barton wrote:
> 
>>>> if uname -s can differentiate Debian from other systems, it's easy enough
>>>> to
>>>> make /usr/share/fonts/freetype as the initial directory for those systems.
>>> 
>>> I suggest parsing etc/freetypecap, and either using the directory part
>>> of the path for the first font in that file, or the directory used by
>>> most fonts (the former is easier, the latter is probably more useful).
>>> 
>>> E.g.
>>> 
>>> cat $GISBASE/etc/freetypecap | awk -F: '{print $2}' | sed 's!/[^/]*$!!' |
>>> uniq
>>> -c | sort -nr | head -n 1 | cut -c 9-
>>> 
>>> Alternatively, you could replicate the logic of mkftcap (formerly
>>> d.freetypecap), i.e. scan a list of candidate directories and settle
>>> for the first one which exists.
>> 
>> This is logical. Any suggestion on how to figure out the directory used by
>> most fonts?
> 
> cat $GISBASE/etc/freetypecap | awk -F: '{print $2}' | sed 's!/[^/]*$!!' | uniq
> -c | sort -nr | head -n 1 | cut -c 9-
> 
> Actually, it should check for $GRASS_FT_CAP, and only use
> $GISBASE/etc/freetypecap as a fallback.
> 
> If you wanted to bypass freetypecap altogether and scan the
> directories yourself:
> 
> for dir in ... ; do
>     if [ -d "$dir" ] ; then
>         find "$dir" -type f -iname '*.ttf' -print
>     fi
> done | sed 's!/[^/]*$!!' | uniq -c | sort -nr | head -n 1 | cut -c 9-
> 
> If you wanted to do it entirely in Tcl, you would need to perform
> directory traversal, as the actual font files will frequently be in
> subdirectories of the standard font directories.

__________________________________________
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 




More information about the grass-dev mailing list