[mapserver-users] Label alignment

Stephen Woodbridge woodbri at swoodbridge.com
Thu Mar 15 16:54:58 EDT 2012


Ian,

Label text is positioned based on the bbox enclosing the text and in the 
case of your three labels the position point is the upper left corner.

If you had concatenated the text into a single line then the would have 
been aligned but still positioned based on the bbox.

Thomas is more knowledgeable about the rendering engine, but I would be 
concerned about any code that potentially changes how labels are placed 
for fear of messing up the existing code and behavior.

In 6.2 there is support for svg symbols, it might make sense to create 
an svg symbol with the text you want as you would have excellent 
controls on the layout, then you could place and or scale that symbol 
where you want it on the map. I was surprised when I started playing 
with Inkscape (an SVG editor) that all their documentation was actually 
svg files.

-Steve

On 3/15/2012 2:00 PM, Ian Walberg wrote:
> Folks,
>
> Attached is an image illustrating the problem, a picture is worth a
> thousand words!
>
> All this text is at the same vertical location but as this shows the
> text is not drawn as would be typical in other applications relative to
> line underneath the text so that the upper and lower case align at the
> bottom with any descending parts of the characters dropping below that
> line.
>
> What we would like to be able to do is use that line as the anchor point
> vertically and horizontally as today left, right or centre.
>
> We may also be able to help make the changes if we can agree what is
> required.
>
> Thanks
>
> Ian
>
>
> -----Original Message-----
> From: mapserver-users-bounces at lists.osgeo.org
> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Stephen
> Woodbridge
> Sent: Tuesday, March 13, 2012 6:35 PM
> To: mapserver-users at lists.osgeo.org
> Subject: Re: [mapserver-users] Label alignment
>
> I'm not sure I understand all of these issues, but have you tried
> concatenating all the your test into a multiple line string and use a
> special character as the line break indicator, say an '@' char. Then in
> the LABEL block use WRAP '@'
>
> You can also use ALIGN CENTER|LEFT|RIGHT to control the alignment of the
> wrapped text.
>
> In 6.2 (trunk) you can also have multiple LABEL blocks in a class and
> can control the position of each using OFFSET x y to nudge you text into
> alignment.
>
> -Steve W
>
> On 3/13/2012 9:26 PM, Ian Walberg wrote:
>> Folks,
>>
>> I am not sure what the correct terminology is for our current issue
>> but let me give explaining it a try.
>>
>> We are using a label layer with transform off to display some overview
>
>> information on a map.
>>
>> The text sometimes needs to be lined up horizontally or spaced evenly
>> vertically.
>>
>> It appears that the text function is using the outer perimeter of the
>> text as the anchor point for the location.
>>
>> So in the case where there are characters which drop below the normal
>> text line (e.g. g, y p, j, q) then the text is not aligned as we would
>
>> hope. The same is true for the top of the text with different
>> characters of course.
>>
>> The text is then not aligned as you would expect if different labels
>> are drawn say 3 in a row horizontally at the same vertical location.
>>
>> If we concatenate the labels to a single string this helps the
>> individual lines but is misaligned vertically.
>>
>> So is there any way (or any plans) to help this? It could be that at
>> alignment mode that is relative to either end of the line (not sure
>> what it's called) under the text would be what we need. This could
>> also in some instances tidy up more traditional labels as they would
>> be draw a little more naturally relative to the point.
>>
>> Looking forward to your thoughts and comments.
>>
>> Thanks
>>
>> Ian
>>
>>
>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the mapserver-users mailing list