Skip to content
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

Better line breaking #188

Closed
ansis opened this issue Nov 8, 2013 · 10 comments
Closed

Better line breaking #188

ansis opened this issue Nov 8, 2013 · 10 comments
Assignees

Comments

@ansis
Copy link
Contributor

ansis commented Nov 8, 2013

It should be possible to set a max label width and then line-wrap.

@kkaefer
Copy link
Member

kkaefer commented Nov 8, 2013

Note that we have to do this on the server when we calculate the shaping with pango. Pango accepts a maximum width and wraps according to writing direction.

@ansis
Copy link
Contributor Author

ansis commented Nov 8, 2013

If the server added an indication of where breaking is allowed, and the direction of the text, could we do the rest on the client?

@nickidlugash
Copy link

Just curious where we are on this.

POI labels are particularly troublesome without line-wrapping:
screen shot 2014-05-08 at 11 19 32 am

tracking for Outdoors style: https://github.com/mapbox/gl-ported-maps/issues/2

@mikemorris
Copy link
Contributor

@springmeyer What do you think of @ansis' suggestion? I've seen how mapnik implements this, haven't ported over to fontserver yet though.

@springmeyer
Copy link
Contributor

Yes, @ansis's suggestion sounds reasonable to me. Variable wrap-width is pretty critical as evidences with a quick scan of https://github.com/mapbox/mapbox-streets-style.tm2/blob/master/label.mss.

@mikemorris
Copy link
Contributor

Opened mapbox/node-fontnik#28

@ansis
Copy link
Contributor Author

ansis commented May 15, 2014

we might be able to do this in the browser.

https://github.com/devongovett/linebreaker
http://www.unicode.org/Public/6.2.0/ucd/LineBreak.txt

The table could probably be compressed and/or simplified well enough for our needs. The algorithm itself is pretty simple

@mikemorris
Copy link
Contributor

Implemented by @ansis in 9f25d1b

@mikemorris
Copy link
Contributor

This will eventually need to break on more than just spaces, using the Unicode line breaking algorithm referenced by @ansis.

http://www.unicode.org/Public/7.0.0/ucd/LineBreak.txt
http://rishida.net/scripts/samples/wrapping.html

@mikemorris mikemorris reopened this Jun 18, 2014
@mikemorris mikemorris assigned mikemorris and unassigned ansis Jun 18, 2014
@mikemorris mikemorris changed the title label line-wrapping Line breaking Jun 18, 2014
@mourner mourner added this to the future milestone Jun 24, 2014
@mourner mourner changed the title Line breaking Better line breaking Aug 6, 2014
@jfirebaugh jfirebaugh removed this from the future milestone Jun 15, 2015
@mourner
Copy link
Member

mourner commented Oct 27, 2015

I think what we have after 53b81da is good enough for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants