[GRASS-dev] figureing out fonts - part 3 correction
Glynn Clements
glynn at gclements.plus.com
Mon Apr 30 04:42:06 EDT 2007
Hamish wrote:
> > Further testing and looks like d.text DOES respect GRASS_FONT settings
> >
> > This leaves only d.label
>
> d.labels is only a conduit. It works using the font given in labels file
> and is not subject to local override. Choose the font you want at the
> v.label step.
>
> I guess we could change it to look the other way on that if the labels
> file is using the default, "font: standard".
>
>
> currently do_labels.c has:
>
> #define STANDARD_FONT "romans"
> ...
> if (sscanf (text, "%*s %s", font) != 1
> || !strcmp (font, "standard"))
> strcpy (font, STANDARD_FONT);
>
> we could change that hardcoded "romans", but it needs to be done
> explicitly as other previous labels may have changed the font to
> something specific already. (different labels in the same file can
> use different fonts) How to do *string = {G|R}_get_current_font();
> rather than just trusting the current state?
There is no R_get_current_font(). Nor for any of the other persistent
state (line width, text size, text rotation, current point, current
colour, maybe others).
But that's not what d.labels does at present; "standard" selects
"romans" rather than the current font at module startup (i.e. that
selected by d.font). In that regard, the corresponding fix would be
e.g.:
const char *std_font;
std_font = getenv("GRASS_FT_FONT");
if (!std_font)
std_font = getenv("GRASS_FONT");
if (!std_font)
std_font = "romans";
We should probably kill one of GRASS_FONT/GRASS_FT_FONT now that there
are no longer separate stroke/freetype fonts.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list