-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Full-width character block (CJK) breaks rendering #931
Comments
BTW: To reproduce here on native, just zoom around Japan for a while — you'll notice the above error and lots of unrendered blocks, even with the stock |
To clarify, does this only affect full-width latin characters, like the numbers used on highways, or does it affect all full-width characters? It seems like regular full-width (like 国道) are rendering just fine. |
It only affects the characters and symbols in range 65280-65535 (i.e., at the end of the basic unicode range), so far as I can tell, sorry. I've edited the original post to emphasize that kanji/etc aren't broken. This "Halfwidth and Fullwidth Forms" block includes full-width latin alphabet, roman numbers, basic symbols, and half-width Japanese and Korean syllabaries. The half-width Japanese and Korean aren't as common, relatively, but I'm sure somebody has tried to use them on OSM, too. |
It looks like there are multiple issues here. The range in the URL above -- But, when I feed the correct range to the fontstack, it produces a 500 error. So there's probably a boundary condition error there too. |
mbgl/text/glyph.cpp purposely clips the range short: // Note: this only works for the BMP
GlyphRange getGlyphRange(char32_t glyph) {
unsigned start = (glyph/256) * 256;
unsigned end = (start + 255);
if (start > 65280) start = 65280;
if (end > 65533) end = 65533;
return { start, end };
} |
Hah, this could very well be a typo - possible that the intended max extent should actually be Check out node-fontnik for the code that's actually pulling these glyphs from Freetype for more details @friedbunny. |
@jfirebaugh The 500 error is because a |
Oops this looks wrong https://github.com/mapbox/node-fontnik/blob/master/bin/build-glyphs#L27-L33 |
Thanks @mikemorris, I didn't know where fontstack came from, repo-wise. That looks extremely promising. 👍 |
@mikemorris So the block is supposed to be |
Yep, correct @jfirebaugh |
@mikemorris Has mapbox/node-fontnik/pull/72 found its way into production? The fontstack request for this glyph range still returns |
The above fontstack fix has landed in production and #946 will fix everything here once it's merged, yay! |
The fontstack can't serve the full-width latin characters that are unfortunately common in Chinese, Japanese, and Korean (CJK), which results in entire sections of the map failing to draw when they're used. This is especially problematic when using country-localized labels (i.e.,
name
and notname_en
) in a style.EDIT: Kanji and other CJK character sets render without any problems, only this specific block fails.
Currently, attempting to use these full-width characters throws an exception when trying to load the remote glyph PBF:
Here is an example of full-width numbers on a Japanese highway on OSM. The left section of the tunnel is correct (国道41号), while the right has full-width numbers (国道41号).
Ultimately, the fontstack needs to be able to serve full-width latin characters or MBGL should replace them with regular latin, half-width characters. #930 only temporarily fixes the drawing issues by returning a common glyph range, which means the full-width characters don't get drawn. (Mapbox-GL-JS currently has a similar behavior.)
Cheers!
The text was updated successfully, but these errors were encountered: