Opened 19 years ago

Closed 19 years ago

#1425 closed defect (duplicate)

[Label] Positioning labels with y p g or j

Reported by: jlacroix Owned by: mapserverbugs
Priority: high Milestone:
Component: MapServer C Library Version: 4.8
Severity: normal Keywords:
Cc:

Description

You may have noticed that when MapServer draw text with or without text under
the label line (lowercase y, p, g and j) the label position changes. So a road
name with a 'p' in it may be a little bit off. This may cause problem when the
name of the road is inside the road at small scale.

This can also cause big trouble when all characters are drawn alone (to follow
the road/river curves). This will give all 'y', 'p', etc. to be like uppercase
letters (See attached image).

The fix for this could be straight forward because GD returns us the label bbox
and it may contains a positive MaxY value for 'y', 'p', etc.. For example the
BBox of 
'g' can be: {-1, -6, 7, 3}
while 'r' is: {0, -6, 5, 1}

So if we are able to define when the ymax is a "below the line" character, we
could apply an offset of this value on the label.

Steve, What do you think of this? Do you think we should make this optional
(with a mapfile parameter for example)?

Attachments (1)

mapinfo_vs_mapserver.gif (6.6 KB ) - added by jlacroix 19 years ago.
mapserver.gif - Image that describe the problem

Download all attachments as: .zip

Change History (5)

comment:1 by jlacroix, 19 years ago

Steve, any opinion on that?

comment:2 by sdlime, 19 years ago

Julien: Could you post an example of the problem? It's not something I've 
noticed but I'm probably just used to seeing it one way.

Steve 

by jlacroix, 19 years ago

Attachment: mapinfo_vs_mapserver.gif added

mapserver.gif - Image that describe the problem

comment:3 by sdlime, 19 years ago

Ok, I see it on the bottom image. Seems to me this should be a transparent fix, 
that is, the user shouldn't have to do anything. No new parameter, just offset 
slightly text with the those specific characters.

I wonder if we should look at the code that positions the text and tell it 
somehow to ignore below the line metrics returned from GD/Freetype? That way 
the positioning would be correct from the start. I need to briefly re-aquaint 
myself with some of the label drawing code. More soon...

Steve

comment:4 by sdlime, 19 years ago

Resolution: duplicate
Status: newclosed
Someone beat me to it, there's a patch in bug 1449 that seems to fix this 
problem. I can apply to 4.7 and you guys can test...

Steve

*** This bug has been marked as a duplicate of 1449 ***
Note: See TracTickets for help on using tickets.