[GRASS-dev] Re: [GRASS-user] Freetype fonts in gis.m

Hamish wrote:

Adding a d.font.freetype "cmd" to the gis.m command list will run, but
doesn't seem to have any effect on the rendering.

You have to add it below the layer which draws the text (so that it is
run first), and you have to force it to be executed, e.g. using the
"Redraw all layers" button.

If the layer containing the text is re-rendered but the
d.font.freetype command is skipped because the layer hasn't changed,
the text will use the default "romans" font instead.

I'd suggest going through the d.* commands which use R_text() without
setting an explicit font and adding font= options.

However, first we should think about how to handle FreeType fonts.

E.g. whether it's up to the application to figure out whether to use
R_font() or R_font_freetype(), or whether the two should be merged.
Personally, I favour the latter. On option is to have an explicit
prefix on FreeType font names (e.g. "font=ft:luximr" will look for a
FreeType font). Another is to try the name as a vector font first then
as a FreeType font if that fails (or the reverse).

Also, vector fonts have a fixed encoding, while FreeType fonts support
a user-configurable encoding.

[FWIW, 21 modules use R_text(), of which 6 also use R_font(), while
the rest use the "current" font, which is a rather awkward concept
within gis.m.]

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

> Adding a d.font.freetype "cmd" to the gis.m command list will run,
> but doesn't seem to have any effect on the rendering.

You have to add it below the layer which draws the text (so that it is
run first), and you have to force it to be executed, e.g. using the
"Redraw all layers" button.

If the layer containing the text is re-rendered but the
d.font.freetype command is skipped because the layer hasn't changed,
the text will use the default "romans" font instead.

ah, ok, d.font.freetype works as a gis.m "command layer" if I flush the
image cache.

thanks,
Hamish