[mapserver-dev] Enhancement to RFC-40 conditional wrapping
Stephen Woodbridge
woodbri at swoodbridge.com
Wed Feb 25 11:35:13 EST 2009
Daniel Morissette wrote:
> In RFC-40, we added the ability to do conditional wrapping, that is
> wrapping labels only if they exceed a specified length:
>
> http://mapserver.org/development/rfc/ms-rfc-40#line-wrapping
>
> One of our users reported a problem with labels such as
> "Notre-Dame-du-Rosaire" or "Saint-Pierre-de-la-Rivière-du-Sud"... I
> didn't make up those names, municipality names in Quebec all use
> hyphens, and some are very long and can sound quite "interesting".
>
> Anyway, the problem is that when we use conditional wrapping on those
> labels, using the hyphen as the wrap character, we end up with something
> like:
>
> Notre-Dame
> du-Rosaire
>
> we lose the second hyphen. What we would like to get is:
>
> Notre-Dame-
> du-Rosaire
>
> Thinking about this some more, I realized that in the case of
> hard-wrapping (maxlength < 0) we may want the ability to insert a hyphen
> at the end of each line. It's not that simple in French, but in English
> one could wrap "someveryverylongword" and expect:
>
> someveryve-
> rylongword
>
> Perhaps the solution to both problems would be to add the ability to
> specify a character to insert at the end of each line? Not sure what to
> call it... WRAPTEXT, WRAPEOL, WRAPMARK, ???
>
> Or another more scalable option could be to add a WRAPMODE param, with
> the different modes being
> - wrap on each instance of the WRAP char
> - conditional wrap on maxlength
> - hard wrap on maxlength
> - and for each case above, insert or not a hyphen (or other char) at
> end of line, or keep the wrap char there instead of removing it from the
> string
Daniel,
I like the idea of adding WRAPMARK <char> to specify and control whether
you mark the wrap point with <char>.
I also think that adding WRAPMODE <mode> or LABELMODE <mode> would make
the behavior much more explicit and obvious, which I would hope would
make it easier for people to understand and use. Having to lookup or
memorize the behaviors in the proposed matrix of len == 0|<0|>0 and
existance of WRAP is not very obvious.
Also it is not obvious that no WRAP and MAXLENGTH >0 should skip the
label or truncate the text of the label to MAXLENGTH! Should
TRUNCATE|SKIP be explicit modes?
<mode>
EACH
CONDITIONAL
HARD
SKIP
TRUNCATE
or something like that.
-Steve W
More information about the mapserver-dev
mailing list