[GRASS-dev] improved d.labels rendering

Hamish hamish_nospam at yahoo.com
Tue Apr 17 02:52:28 EDT 2007

> > Wolf wrote:
> >> I haven't tested multi-line labels, but rotation seems to work
> >> nicely. There is however a bug. If there is a space between the ':'
> >> and the label text, the space becomes part of the label and thus
> >> the label is shifted to the right by one space. I have worked
> >> around this in v.label.sa by not adding a space between the ':' and
> >> the label text.
> > this is a bug in the rendering stage, not at the labels file
> > creation stage (there is nothing wrong with the labels file). Fixed
> > last week in d.labels/do_labels.c revs 1.20,1.21 with the improved
> > rotation code.
> Yes, exactly as I said. However it isn't fixed (see attached screen
> shots; with_space.png and without_space.png)

sorry, I don't understand. Are Yichang and Kinmen supposed to be lined
up in those? Or are you saying that all text (regardless of multi-line)
are shifted +1 char to the right?

Can you create a labels file from spearfish's bugsites and edit the
labels file so one of the entries is like-
text: line of text1\nline of text 22\nline of text 333

then post the exact v.label command line + label entry to recreate the

what does your text: entry look like for each of those screenshots?
text: Yichang\nKinmen

Perhaps only seen with TTF?

> >> I have also attached a patch which will add support for a label
> >> position "none none", which simply means to place the label at the
> >> exact point given (no shifting in any direction).
> > how does that differ from center,center (the default)? or is it
> > "raw", which is {R_move_abs(x,y); R_text(string);} in that case how
> > does none,none differ from the lower,left case?
> > (why is this useful?)
> I want the lower left corner of the text should go exactly on the
> point given in the labels file.

as given by the lower-left corner of the bounding box around the text,
or the lower-left corner of the first letter [or letter block] of text?

ps.map seems to justify the text directly on the edge of the bounding
box. d.labels currently pads a bit of space between the point and the
label, this extra space is by design. I think that the 1 space padding
before the start of the border box is nicer. Regardless, ps.map and
d.labels should try and do the same thing, be it padding or no padding.

With "none" are you trying to remove the padding from d.labels?

> center,center puts the center of the
> text, and lower,left put the lower left, but with some magic
> adjustment. So I guess it is sort of "raw". In v.label.sa I calculate
> the exact position of a label and it may not be shifted, or else the
> algorithm doesn't hold.

(so it works? great!)
I think I will have to try .sa well to understand the problem properly.
Any spearfish maps which are a good example?

> If someone could just verify that the attached patch works, I can
> commit it. (I have made it against the most recent CVS version)

I would like to understand the problem better before committing anything
to CVS. (ie be comfortable that we are not adding new features to work
around some shortcoming when we should be instead fixing that shortcoming
in the first place)
Unfortunately today I am short on time and capacity to help. :-/


More information about the grass-dev mailing list