[GRASS-dev] improved d.labels rendering

Wolf Bergenheim wolf+grass at bergenheim.net
Tue Apr 17 09:10:17 EDT 2007


On 17.04.2007 09:52, Hamish wrote:
>>> 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.
> Hamish:
>>> 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?

Exactly. Shifted +1 char to the right (by the width of a space character)

> 
> 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
> bug?

I use v.label.sa to generate the label files, and I'm quite sure there
is no bug in that (as it is basically a copy of what d.label does).

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

Sorry, it was perhaps a bad example. Yichang and Kinmen are 2 labels,
and if you look at the two images you see that the first (with space) is
shifted to the right by one " " character. The with_space version has
label text like
text: Yichang
And the without_space has
text:Yichang

I have added another screen shot showing the label point and the label
text with and without space, and the effect of my patch to add none none
support.

Here is the labels file for these:
-------------------------------------------------------------------
east: 662726.716593
north: 4036029.863873
xoffset: -0.000000
yoffset: -0.000000
ref: lower left
font: /usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf
color: green
size: 150.000000
width: 1
hcolor: none
hwidth: 0
background: none
border: none
opaque: yes
rotate: 0.000000
text: LL Space

east: 662726.716593
north: 4036029.863873
xoffset: -0.000000
yoffset: -0.000000
ref: lower left
font: /usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf
color: blue
size: 150.000000
width: 1
hcolor: none
hwidth: 0
background: none
border: none
opaque: yes
rotate: 0.000000
text:LL No Space

east: 662726.716593
north: 4036029.863873
xoffset: -0.000000
yoffset: -0.000000
ref: none none
font: /usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf
color: red
size: 150.000000
width: 1
hcolor: none
hwidth: 0
background: none
border: none
opaque: yes
rotate: 0.000000
text: N Space

east: 662726.716593
north: 4036029.863873
xoffset: -0.000000
yoffset: -0.000000
ref: none none
font: /usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf
color: black
size: 150.000000
width: 1
hcolor: none
hwidth: 0
background: none
border: none
opaque: yes
rotate: 0.000000
text:N No Space
-------------------------------------------------------------------

The point is located at the north, east coordinates given in the label
file. I can live with the minimal shift which is probably due to cell
size or something. Note that all four labels have the same coordinates.

--Wolf

-- 

<:3 )---- Wolf Bergenheim ----( 8:>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: d.labels_problem.png
Type: image/png
Size: 24279 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20070417/9c64acbc/d.labels_problem.png


More information about the grass-dev mailing list