-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Take white space's advance into account when processing line breaking #11094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ble item, this is needed for badness calculations between current index to any previous potential breakables, so this tailed white space won't be accounted in the badness calculation.
1a3830b to
19b8d1c
Compare
|
This looks good to me! We should double check with some map designers that the change in behavior is acceptable. Styles designed with the old (wrong) behavior are going to look slightly different now. I think that is probably preferable to not fixing. An example with a non-mono font could be helpful for that. |
|
Hi! @zmiao, trying to better understand the visual impact of this fix: Is it correct that the |
|
@melanieimfeld that's right, the whole tendency of the line width per line will most probably become narrower than before if there are several empty spaces in the line. As with this change, the white space's width will be taken into account for line breaking determination. |
|
@zmiao I was looking at streets-v11 to see if there are any impactful visual changes to the line break logic in long label names. I found relatively few changes:
Our core styles are using That's to say that the change shouldn't impact our core styles in a noticeable way. The most noticeable change will be with styles using custom labels with a very long text. I can't think of any such styles in the wild, but I do know that @JonniWalker1977 has been experimenting with large text labels! |








Launch Checklist
Previously, all the invisible codepoints' advances are not taken into account to text's accumulated width, even if the advance is not zero, such as white space
' '. The bug is revealed with Mono fonts as the white space from the font family has a bigger advance, 14 from two Mono fonts being tested, while the advance of default fonts is only 6.@mapbox/map-design-team@mapbox/static-apisif this PR includes style spec API or visual changes@mapbox/gl-nativeif this PR includes shader changes or needs a native portmapbox-gl-jschangelog:<changelog>Fix line breaking behavior by taking the white space's advance into account.</changelog>