artemp/trac2github — Issue #486: TextSymbolizer vertical_align should have varying default
Author: artemp
Created: 2011-10-09 20:37:03+00:00
State: open
Labels: Symbolizers

Consider a common case:

* A symbol with a text label.
* You use dy to move the text label to appear just under the symbol.
* The default is vertical_alignment="middle".
* The label is being dropped the moment you have multiline labels.

A single line label with default valign shows:

[[Image(valign-middle_1line_dy16.png)]]

A two line label with default valign is being dropped, because the upper line now intersects the symbol:

[[Image(valign-middle_2line_dy16.png)]]

A two line label with bottom valign:

[[Image(valign-bottom_2line_dy16.png)]]

This is now a bit too far away from the symbol, so we can put it closer:

[[Image(valign-bottom_2line_dy10.png)]]

Single line labels are still as close to the symbol as well:

[[Image(valign-bottom_1line_dy10.png)]]

In fact, with bottom alignment, it doesn't matter how many lines you have, as they will always start just under the symbol.

The same logic works in reverse when placing the label above the symbol.

The default vertical_alignment for TextSymbolizer should depend on the value of dy:

|| dy = 0 || vertical_alignment="middle" ||
|| dy > 0 || vertical_alignment="bottom" ||
|| dy < 0 || vertical_alignment="top" ||