[GRASS-dev] font path question for Linux and Windows

William Kyngesburye woklist at kyngchaos.com
Mon Apr 30 12:14:15 EDT 2007

On Apr 30, 2007, at 3:34 AM, Glynn Clements wrote:

>> Note that font names on OSX aren't required to follow any file
>> extension conventions.  First the HFS+ file type/creator is used to
>> determine if a file is a font, then the file extension if the type/
>> creator are empty.  I think it's that order.
>> So scanning automatically for fonts to create the freetypecap may
>> miss many fonts, unless it knew how to check OSX type/creator info
>> for a file.
>> ie the MS fonts that come with the system have no extension.  Also,
>> many TT fonts in OSX have been repackaged in the .dfont (a flattened
>> resource-fork file).
> In which case, users will need to construct the freetypecap file
> manually.
If you do that, there is not much point to the automatic scan - most  
of the useful TT fonts that are included with OSX are either dfonts  
or have no extension.  Most, if not all, of the included .ttf TT  
fonts are miscellaneous language fonts.

But, then there is another problem (and in general TT font usage) -  
d.font.freetype doesn't handle multiple faces in a file.  Many dfonts  
and resource fonts (the ones with no extension) have multiple faces  
in a single file (ie regular, italic, bold..).  Without specifying  
the face index or name, freetype defaults to the first face in a font  
file. (I thought I made a feature request for this, but I don't see  
it in either tracker)  There is no guarantee that plain/regular will  
be the first face in a font file, so you may get italic or bold or  
other unexpected style.

A few more comments:

- Add /System/Library/Fonts to the search paths (assuming some way to  
handle other file extensions, or lack of, is worked out, as well as  
multiple faces in a file).  Helvetica and Times are in here.  As well  
as Lucida Grande (with a fairly complete international character set)  
and a few other basic fonts.

$HOME/Library/Fonts would be another good default dir to search.  And  
to do these in the proper OSX order of precedence would be: $HOME/ 
Library/Fonts /Library/Fonts /System/Library/Fonts.  $HOME can have  
spaces if it's on a network driver, so that path at least should be  

- Maybe Michael's proposed font path env var could be used here?  For  
additional user font paths to search automatically.

- since this is now in /tools and installed in etc/, that implies  
that mkftcap will get run automatically somehow?  From GUI?  Or some  
future script module?  On startup?  Then it will destroy a user's  
manually created freetypecap, so it should be as thorough as  
possible.  Or add some sort of divider in the freetypecap between  
user entries and auto-generated entries, and mkftcap would not  
overwrite user edits.

- regenerating the freetypecap at runtime in the GRASS application  
folder is not a good thing on OSX (see my previous discussions about  
OSX apps and user preference/config/addon files).  There should be  
some way to have GRASS look for alternative external freetypecap  
files, for both generating the freetypecap file, and reading it to  
set the font.

This is a good candidate for my new G_find_etc() function.  Find the  
first writable freetypecap in the etc paths (G_find_etc() would need  
to be expanded to do that).

William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>

Earth: "Mostly harmless"

- revised entry in the HitchHiker's Guide to the Galaxy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20070430/035dda9c/attachment.html

More information about the grass-dev mailing list