Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Improve label WRAP #5613
We want to improve label wrapping in MapServer so that road labels can be wrapped at space and dashes.
It goes into the same direction as #3266 and http://osgeo-org.1560.x6.nabble.com/Enhancement-to-RFC-40-conditional-wrapping-td4260294.html
MapServer only allows a single WRAP character. A possible solution would be to wrap at Unicode ZERO WIDTH SPACE (0x200b) and let the user insert this everywhere a wrap is possible. ZERO WIDTH SPACE is not rendered by Mapserver. This character can be inserted with PostgreSQL
However, WRAP is a char and does not support Unicode. Instead of changing this type (and opening a whole can of new issues), I suggest that we allow to insert an ASCII control character as a marker for ZERO WIDTH SPACE. RECORD SEPARATOR or UNIT SEPARATOR for example.
It's difficult to insert these chars for most endusers, maybe we can add a keyword for this and replace it internally with the ASCII control char? I don't know how the Mapfile parsing works and how this would be implemented.
Another idea would be to accept that wrapping at space is a common use case and change the default behavior to automatically wrap at SPACE and ZERO WIDTH SPACE. I would prefer this. ZERO WIDTH SPACE should be so uncommon that backwards compatibility should not be an issue.
The msLayoutTextSymbol function needs to be changed to wrap at the provided WRAP char or at ZERO WIDTH SPACE if that char is RECORD SEPARATOR. This change is required anyhow (see #5612).
I have a working prototype and I can provide a PR.
I use WRAP with RECORD SEPARATOR (
Mapserver can then break both labels at every
I would much prefer to make this the default behavior, inserting a RECORD SEPARATOR into a Mapfile is everything but easy for users.