Yeah! That's more like it. Some samples from OSX (default 'new'
- resource font (and the one that's not showing up in fc-list):
Arial Bold Italic|1|/Library/Fonts/Arial|3|utf-8
Times Bold Italic|1|/System/Library/Fonts/Times.dfont|11|utf-8
Times Bold Italic|1|/System/Library/Fonts/Times.dfont|3|utf-8
Times Bold Italic|1|/System/Library/Fonts/Times.dfont|7|utf-8
Strange - almost ALL the dfonts have tripled indexes for each style.
And always alternating indexes. I'm not sure what that's all about,
but with the dulicate names, only one of the triplet will be usable.
As a test I made the names unique for the Times styles in my
freetypecap file and drew each of them - they all work. So it
appears that only the first one of each triplet is needed.
One suggestion - make it useable outside of GRASS, or during the
startup process. (I tried it and got a segfault)
This would be useful for a first-time run of GRASS when an alternate
$GRASS_FT_CAP is used, and that doesn't exist yet. Maybe default to
stdout in this case, since GISBASE might not be set.
I'm thinking of a binary install (especially OSX) that will build a
user freetypecap to use in place of the built copy in the GRASS
binary, but not overwrite the GRASS binary copy, since the user might
not have admin privileges. Maybe run it in init.sh if GRASS_FT_CAP
is set and the referenced file does not exist yet. I guess if run in
init.sh, it could be run at a point when the necessary env vars are
Postscript fonts - no worries there, if FreeType supports them,
they're listed (I have a couple in my /Library/Fonts folder).
Another possible option - write to $GRASS_FT_CAP, if set. Or to a
user-supplied file path.
Post by Paul Kelly
I've done that now. See attached for the prototype in case anybody
would like to try it. What it does is search through all the files
in the list of directories we gathered (hard-coded in main.c).
Rather than checking the file extension it examines each file using
Freetype functions to see if it is a font or not. This should work
for font files with no extension if they exist. It should also get
the multiple fonts in one file OK - would be especially interested
to see what it comes up with when run on a Mac system.
I haven't done anything yet about finding duplicate fonts - I don't
have any on either the Windows or Linux systems I tested this on.
The list is sorted first by font type (stroke or freetype) and
secondly name. I've just gone with a fully descriptive name,
including spaces for the names. The elegant simplicity of that
approach for the GUI font selection box seems to work quite well.
The version of the program (called g.mkfontcap for now) attached
can write a file in either the current freetypecap format, or the
proposed new fontcap format, which (in order to be Windows-
compatible) separates all the fields with a vertical bar - and
includes the index within each font file and the type of font
(stroke or freetype) as fields also. Hopefully this format should
be easily extendible to include PostScript fonts too?
I'm still not very sure at all about the meaning of the encoding
field or if it should be included, or even if it depends on the
fonts in any way at all and if there's any way it should be derived
If we can decide on a name - maybe g.mkfontcap is all right? - I
can submit it to CVS for further improvements.
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
"Time is an illusion - lunchtime doubly so."
- Ford Prefect