[GRASS-dev] using system fonts?

Glynn Clements glynn at gclements.plus.com
Mon Apr 23 14:44:44 EDT 2007


Michael Barton wrote:

> Perhaps this is a silly question, but is there any way to use system fonts
> in GRASS. Currently, we either need to use a stroke font (the default, ugly)
> or specify a path to a Truetype font.
> 
> It is quite easy to get system font information (family, name, style, size,
> color, etc) from a standard system font dialog in wxPython (and in TclTk
> too). Is there some way to pass that information to GRASS so that it will be
> the display font. Or could there be a flag/GRASS environmental variable, to
> make the default system font the default GRASS font? Then the default could
> be changed as desired. Imagine Helvetica/Lucida Grand/Arial as the default
> font for legends, bar scales, and the like...

Adding support for bitmap fonts would be reasonably straightforward,
but getting those fonts without using X might be a different matter
(bear in mind that there might not be any font files on the local
system. X can get its fonts from a font server).

Personally, I would have thought that the Freetype support would be
sufficient. If it isn't, I can look into either stealing the
PCF-reading code from X, or writing an X-based font-dumping utility. 
Obviously, I don't want to make the PNG/PS drivers link directly
against Xlib.

BTW, the term "default system font" isn't clear-cut. Different
toolkits may have different ideas as to the default font. Xt uses X
resources. Tcl/Tk manually parses certain X resource files (but not in
the same that Xt does), so it might use the same font as Xt-based
applications or it might not. GTK and Qt have their own mechanisms,
and can vary depending upon whether they are being used under Gnome or
KDE.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list