You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The wrap-character option is no longer respected and should be removed from the code base to avoid confusion.
Supporting breaking on a user provided character is no longer supported. In the future we could perhaps look into a custom RuleBasedBreakIterator to be able to re-introduce this support. However this is unlikely to work well.
Supporting language-specific breaking is more likely to become a future need, and this will be tricky. Currently we hardcode the default Locale:
while ((start = text_.indexOf('\n', start)+1) > 0)
. For example inserting new line character after 'wrap-char' if it's not '\n' ? But in this case if should really be called break-char. RuleBasedIterator, I think would be quite expensive to initialise per text line:
"...The setText() or the adoptText() method can be called more than once, allowing a single BreakIterator to be reused to analyze different pieces of text. Because the creation of a BreakIterator can be relatively time-consuming, it makes good sense to cache and reuse BreakIterators within an application. "
^^ Strangely, despite documentation stating that BreakIterator should be re-used I'm getting almost 2x slow down when creating it at:
@ajashton - have you got a use case I can work with ?
Open to ideas from @ajashton, but I think the usecase is just the way breaks worked before such that say you have a line of text line "this-is@a line@and another" and wrap-character="@" you'd get:
this-is
a line
and another
And the whitespace or hyphens would not be used to break. So, I'm thinking that when wrap-character is supplied we completely disable/ignore/stand-in-front of the ICU BreakIterator and don't let it do its smart things in the case where someone is asking for a manual break.
@springmeyer yes, that's basically the use case and enabling it would also have to mean disabling breaking on whitespace.
However the wrap-character predates the implementation of the replace function in expressions which can cover the same use case ([text].replace('@', '\n')) and is actually more flexible. Given the major version bump I don't think we necessarily need to keep wrap-character around.
However the wrap-character predates the implementation of the replace function in expressions which can cover the same use case ([text].replace('@', '\n')) and is actually more flexible.
Doesn't the wrap-character have the line break effects of a space, not a newline, while also preventing space from having its normal line break effects?
e.g.I 50;I 51 will not be able to break on the spaces, but will on the ;?
I will need to think how we can support this kind 'custom' text wrapping. We might need to add an extra parameter but at this moment I really need to understand if this is something really 'niche' or more common across international cartographic text.
/cc @ajashton@springmeyer
Activity
springmeyer commentedon Sep 4, 2014
re-opening to consider:
/cc @ajashton
artemp commentedon Sep 8, 2014
http://www.unicode.org/reports/tr14/
artemp commentedon Sep 8, 2014
@springmeyer - we can force breaks by modifying itemizer:
mapnik/src/text/itemizer.cpp
Line 46 in 2b1ab49
break-char. RuleBasedIterator, I think would be quite expensive to initialise per text line:mapnik/src/text/text_layout.cpp
Line 127 in 2b1ab49
"...The setText() or the adoptText() method can be called more than once, allowing a single BreakIterator to be reused to analyze different pieces of text. Because the creation of a BreakIterator can be relatively time-consuming, it makes good sense to cache and reuse BreakIterators within an application. "
^^ Strangely, despite documentation stating that BreakIterator should be re-used I'm getting almost 2x slow down when creating it at:
mapnik/src/text/text_layout.cpp
Line 85 in 2b1ab49
@ajashton - have you got a use case I can work with ?
springmeyer commentedon Sep 8, 2014
Open to ideas from @ajashton, but I think the usecase is just the way breaks worked before such that say you have a line of text line "this-is@a line@and another" and
wrap-character="@"you'd get:And the whitespace or hyphens would not be used to break. So, I'm thinking that when
wrap-characteris supplied we completely disable/ignore/stand-in-front of the ICUBreakIteratorand don't let it do its smart things in the case where someone is asking for a manual break.ajashton commentedon Sep 8, 2014
@springmeyer yes, that's basically the use case and enabling it would also have to mean disabling breaking on whitespace.
However the wrap-character predates the implementation of the replace function in expressions which can cover the same use case (
[text].replace('@', '\n')) and is actually more flexible. Given the major version bump I don't think we necessarily need to keep wrap-character around.pnorman commentedon Sep 8, 2014
Doesn't the wrap-character have the line break effects of a space, not a newline, while also preventing space from having its normal line break effects?
e.g.
I 50;I 51will not be able to break on the spaces, but will on the;?text-symbolizer: revive 'wrap-char' property which uses special (naiv…
artemp commentedon Sep 9, 2014
b441586 - 'wrap-char' is back
wrap-char=";" + wrap-width= -->
^^ Is this what we're looking for ? I left
wrap-charas part of the text - @ajashton ?Andrey-VI commentedon Sep 10, 2014
@artemp , great!
But how to achieve this
instead of
from
This-is-a-test?artemp commentedon Sep 10, 2014
@Andrey-VI
I just tried
wrap-width="20" wrap-char="-"with text expression'Mapnik-can do-fancy char wrap'.replace('-','--')Note: this only works if
wrap-widthis forcing text breaksIs this kind of text-wrapping specific to cartographic text or is it used in general ?
Andrey-VI commentedon Sep 10, 2014
Oh, my fault.
is a very bad example. A good one
So, if you try
'Mapnik-can-do-fancy-char-wrap'.replace('-','--'), you getI believe.
But I need something like
instead.
artemp commentedon Sep 10, 2014
@Andrey-VI - I just added 'length(') function which is useful but perhaps not in your use-case
<Filter>length([name]) > 10</Filter>artemp commentedon Sep 10, 2014
I will need to think how we can support this kind 'custom' text wrapping. We might need to add an extra parameter but at this moment I really need to understand if this is something really 'niche' or more common across international cartographic text.
/cc @ajashton @springmeyer
Andrey-VI commentedon Sep 10, 2014
I think this is a common practice to duplicate

-on the new line after text wrapping.Just googled:
Widely used on Russian maps:

text - add ```repeat-wrap-char``` parameter default:false (#2333)
artemp commentedon Sep 10, 2014
@Andrey-VI - I implemented
repeat-wrap-charin f8dc7b0Input text 'This
isatesta onea twoa three'wrap-char="~"wrap-width="100"Andrey-VI commentedon Sep 10, 2014
Thank you, Artem. Looks great!
Unfortunately, I still can't test/use Mapnik 3.x due to incompatibility with mod_tile/renderd.
springmeyer commentedon Sep 14, 2014
Use my branch: https://github.com/springmeyer/mod_tile
[-]Remove wrap-character option at 3.x[/-][+]Status of wrap-character option at 3.x[/+]rename wrap-char -> wrap-character to match Mapnik 2.3.x - refs #2333
add visual test for wrap-character - refs #2333
springmeyer commentedon Sep 22, 2014
wrap-character is now back, working, has basic tests, and a supports being an expression (#2424). Any followups can be made in new tickets like #2427
yohanboniface commentedon Nov 11, 2014
Thanks @artemp for the new
repeat-wrap-characterrule, very useful! :)