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
There are a lot of line wrapping conditions it would be good to capture in visual tests. So far we just have b8a0c16 which tests wrapping on a few custom characters when wrap-character is provided. But the more common usecase is when users do not manually provide wrap-character and instead only provide wrap-width. In this case the wrapping is done automatically based on the locale + ICU break iterator. This needs more test with various types of international text so that if anything regresses we'll understand the changes and in the future if we support intelligent locales the visual tests can capture what improves in the layout results.
Copy from 'Pull requests' section:
After this new visual tests I realized that I need a different behaviour from wrap-character and repeat-wrap-character="true":
if we use, for example, wrap-character="-" and repeat-wrap-character="true" all default ICU line breaking are ignored. How to avoid this?
For now I have two ideas, both of them doesn't break wrap-character behaviour:
Use repeat-wrap-character="[symbol]", so if ICU breaks line at this [symbol] it's repeated on the new line.
Use repeat-wrap-character="true/false" and repeat any ICU line break characters except whitespace characters (RegEx \s class) on the new line.
Thanks for the details @Andrey-VI. I'm having trouble understanding exactly what you need. Could you provide some specific visual images of what you think would be ideal output? Then we will have more of a clear sense of how to implement correctly.
First and third column: wrap-character='', second and fourth: wrap-character='-';
first row: repeat-wrap-character="false", second: repeat-wrap-character="true".
I want to achieve this behaviour:
I'm wondering is it possible to know at what symbol ICU break iterator breaks line? If it is possible than we can introduce repeat-wrap-character="[symbol]" property and repeat only that [symbol] on new lines.
@Andrey-VI - I'm trying to have a fresh look at this issue but I'm confused. Could you provide a test case (XML style file with inlined JSON datasource) which would result in text rendering you mentioned above ? Thanks.
@artemp, visual test: #2539
Unfortunately, in the current version of Mapnik it's impossible to do what I mentioned above. If it were possible, then there would be no request…
The key issue now is: if we use, for example, wrap-character="-" and repeat-wrap-character="true" all default ICU line breaking are ignored. So a names without -, for example Two Four Eight Sixteen Thirty two Sixty four, won't wrap at all.
And for combinations of Two-Four-Eight-Sixteen-Thirty two-Sixty four and Two Four Eight Sixteen Thirty two Sixty four we can get either
Two-Four-
Eight-Sixteen-
Thirty two-
Sixty four
and Two Four Eight Sixteen Thirty two Sixty four
with a small wrap-width, wrap-character="-" and repeat-wrap-character="false"
or
Two-Four-
-Eight-Sixteen-
-Thirty two-
-Sixty four
and Two Four Eight Sixteen Thirty two Sixty four
with a small wrap-width, wrap-character="-" and repeat-wrap-character="true".
Current behaviour:
Desired behaviour (options variant 1):
Desired behaviour (options variant 2):
Thus, for combinations of Two-Four-Eight-Sixteen-Thirty two-Sixty four and Two Four Eight Sixteen Thirty two Sixty four I want to get
@Andrey-VI
Could you try the following patch to see if it addresses your issue ? This is not a proper solution, I'm just trying to understand the issue. The patch always treats (space) character as a potential break point:
@artemp,
master:
master with the patch:
Looks very promising!
But I believe that the second column should not contain the space characters indicated below:
Two-Four-
-Eight-
-Sixteen-
-Thirty two-Sixty four
(wrap-character="-", repeat-wrap-character="true")
and
Two-Four-
Eight-
Sixteen-
Thirty
two-Sixty
four
(wrap-character="-", repeat-wrap-character="false").
The first column does not contain this extra space characters both for
wrap-character="", repeat-wrap-character="true"
and
wrap-character="", repeat-wrap-character="false".
@Andrey-VI - as I mentioned this is just to clarify what is a desirable output visually and not a solution. Extra spaces are occurring because they're treated the same way as a wrap-character (in this case -). To summarise - rendering above minus extra spaces is what you're expecting, right?
@artemp, yes, you're right.
In short: ideally, I want the default ICU line breaking (as in the first column) with the ability to repeat - on new lines.
Hi @artemp, any progress on this?
I recently found out that my custom 2.3.x build does not have #1543 change that I really need. Therefore, migration to 3.x has become even more necessary.
Activity
springmeyer commentedon Sep 22, 2014
/cc @Andrey-VI - would be great if you could supply a pull request that covers some of your common and more rare usecases.
springmeyer commentedon Oct 15, 2014
bump @Andrey-VI - this is your chance to help make sure your future usecases don't break :)
Andrey-VI commentedon Oct 16, 2014
Yep. I'll try to do something for this.
Andrey-VI commentedon Nov 3, 2014
Copy from 'Pull requests' section:
After this new visual tests I realized that I need a different behaviour from
wrap-characterandrepeat-wrap-character="true":if we use, for example,
wrap-character="-"andrepeat-wrap-character="true"all default ICU line breaking are ignored. How to avoid this?For now I have two ideas, both of them doesn't break
wrap-characterbehaviour:repeat-wrap-character="[symbol]", so if ICU breaks line at this [symbol] it's repeated on the new line.repeat-wrap-character="true/false"and repeat any ICU line break characters except whitespace characters (RegEx\sclass) on the new line.I prefer the first one.
@artemp , @springmeyer , is this possible to implement? What are you think?
springmeyer commentedon Nov 3, 2014
Thanks for the details @Andrey-VI. I'm having trouble understanding exactly what you need. Could you provide some specific visual images of what you think would be ideal output? Then we will have more of a clear sense of how to implement correctly.
Andrey-VI commentedon Nov 3, 2014
OK. I'll try to explain more.

Current behaviour:
First and third column:
wrap-character='', second and fourth:wrap-character='-';first row:
repeat-wrap-character="false", second:repeat-wrap-character="true".I want to achieve this behaviour:

I'm wondering is it possible to know at what symbol ICU break iterator breaks line? If it is possible than we can introduce
repeat-wrap-character="[symbol]"property and repeat only that [symbol] on new lines.Andrey-VI commentedon Apr 7, 2015
@springmeyer , do you understand what I want? :)
Andrey-VI commentedon Sep 9, 2015
Ping @springmeyer
Andrey-VI commentedon Apr 13, 2021
@springmeyer, @artemp, 6 years and counting… Is it hopeless?
Still using 2.3.x because of this hyphen issue in Mapnik 3.x :(
See #2333 (comment)
artemp commentedon Feb 17, 2022
@Andrey-VI - I'm trying to have a fresh look at this issue but I'm confused. Could you provide a test case (XML style file with inlined JSON datasource) which would result in text rendering you mentioned above ? Thanks.
Andrey-VI commentedon Feb 17, 2022
@artemp, visual test: #2539
Unfortunately, in the current version of Mapnik it's impossible to do what I mentioned above. If it were possible, then there would be no request…
The key issue now is: if we use, for example,
wrap-character="-"andrepeat-wrap-character="true"all default ICU line breaking are ignored. So a names without-, for exampleTwo Four Eight Sixteen Thirty two Sixty four, won't wrap at all.And for combinations of
Two-Four-Eight-Sixteen-Thirty two-Sixty fourandTwo Four Eight Sixteen Thirty two Sixty fourwe can get eitherand
Two Four Eight Sixteen Thirty two Sixty fourwith a small
wrap-width,wrap-character="-"andrepeat-wrap-character="false"or
and



Two Four Eight Sixteen Thirty two Sixty fourwith a small
wrap-width,wrap-character="-"andrepeat-wrap-character="true".Current behaviour:
Desired behaviour (options variant 1):
Desired behaviour (options variant 2):
Thus, for combinations of
Two-Four-Eight-Sixteen-Thirty two-Sixty fourandTwo Four Eight Sixteen Thirty two Sixty fourI want to getand (something like)
.
artemp commentedon Feb 17, 2022
@Andrey-VI 👍 I need to familiarise myself with current implementation again. I'll try to find time next week (Tuesday). Thanks.
artemp commentedon Apr 20, 2022
@Andrey-VI
Could you try the following patch to see if it addresses your issue ? This is not a proper solution, I'm just trying to understand the issue. The patch always treats
(space) character as a potential break point:artemp commentedon Apr 20, 2022
Andrey-VI commentedon Apr 20, 2022
@artemp,


master:
master with the patch:
Looks very promising!
But I believe that the second column should not contain the space characters indicated below:
Two-Four-
-Eight-
-Sixteen-
-Thirty
two-Sixtyfour(wrap-character="-", repeat-wrap-character="true")
and
Two-Four-
Eight-
Sixteen-
Thirty
two-Sixty
four
(wrap-character="-", repeat-wrap-character="false").
The first column does not contain this extra space characters both for
wrap-character="", repeat-wrap-character="true"
and
wrap-character="", repeat-wrap-character="false".
artemp commentedon Apr 21, 2022
@Andrey-VI - as I mentioned this is just to clarify what is a desirable output visually and not a solution. Extra spaces are occurring because they're treated the same way as a wrap-character (in this case
-). To summarise - rendering above minus extra spaces is what you're expecting, right?Andrey-VI commentedon Apr 21, 2022
@artemp, yes, you're right.
In short: ideally, I want the default ICU line breaking (as in the first column) with the ability to repeat
-on new lines.Andrey-VI commentedon Apr 5, 2024
Hi @artemp, any progress on this?
I recently found out that my custom 2.3.x build does not have #1543 change that I really need. Therefore, migration to 3.x has become even more necessary.