-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Chinese labels should be wrapped by character with balanced lines #1223
Comments
@barrycug Can you please provide more details on what the expected result is versus what is actually rendered? |
I know ,the text wrapped line depend on space.But in chinese ,the text have not include the space. |
Japanese has a similar issue, to a lesser degree because names tend to be shorter. The problem is that it would be difficult to determine where to break an un-spaced line — it would likely have to be specific to each language. Off the top of my head, Japanese could be split on certain characters (like Here's a Yahoo Japan map, which is probably the best designed web map in Japan, if anyone is looking for inspriation. ;) |
thank you very mach. I split the text by the size. It is the most simple solution。Mayby I can insert space into the data,this is the correct solution,because it can use the natural language broken。But it is a hard work。
|
the code only support 2 line wrapped. |
Thanks for the detailed explanation @barrycug and @friedbunny! The "proper" way to implement this would probably be to use something like ICU's |
Linking Mapnik line-breaking implementation here for future reference https://github.com/mapnik/mapnik/blob/master/src/text/text_layout.cpp |
That's really interesting reading and looks like the ideal path to pursue, thanks @mikemorris. Do you have any idea how feasible it would be to do this properly/robustly in GL? |
@friedbunny I think it should be pretty straightforward to implement in gl-native because of existing libraries like ICU and HarfBuzz; the challenge will mostly be avoiding performance slowdowns and minimizing bloat. I'd like to tackle this in conjunction with other render-time glyph issues like complex text shaping and RTL/bidirectional script support. What I expect will be difficult is implementing comparable functionality in mapbox-gl-js, as I'm not sure if it would be feasible to bundle (or request dynamically) contextual line-breaking support or shaping tables, and I don't know any existing JavaScript libraries that have already solved these problems. |
CJK line breaking is orthogonal to complex text shaping. For example, the most cartographically sound way to wrap Chinese text (but not Japanese or Korean) would be character by character, keeping the lines balanced. Reopening. |
Allow a line break to be inserted after any supported Chinese, Japanese, or Yi character in a point-placed label. Balance the lines unless non-ideographic text such as Latin letters are present. Fixes #1223.
Allow a line break to be inserted after any supported Chinese, Japanese, or Yi character in a point-placed label. Balance the lines unless non-ideographic text such as Latin letters are present. Fixes #1223.
Allow a line break to be inserted after any supported Chinese, Japanese, or Yi character in a point-placed label. Balance the lines unless non-ideographic text such as Latin letters are present. Fixes #1223.
* [core] Line-break ideographic text by character Allow a line break to be inserted after any supported Chinese, Japanese, or Yi character in a point-placed label. Balance the lines unless non-ideographic text such as Latin letters are present. Fixes #1223. * [core] Moved more character classing into util::i18n * [core] Detect character properties by Unicode block * [test] Reenabled ideographic breaking tests
the font is "Unifont Medium” .The english is ok
The text was updated successfully, but these errors were encountered: