gravitystorm / openstreetmap-carto

A general-purpose OpenStreetMap mapnik style, in CartoCSS
Other
1.53k stars 818 forks source link

What about Han unification? #2208

Open sommerluk opened 8 years ago

sommerluk commented 8 years ago

[This description is regularly updated to summarize the current state of discussion in the comments.]

What is the problem of Han unification for openstreetmap-carto?

The problem of Han unification is a general problem that is independent of any specific font!

Question: How to render CJK names and other text in the native language?

Does this problem also exist in other regions of the world?

Yes.

Technically, these problems are almost identical to the problem of Han unification.

Are there other problems that have the same technical base?

What is the current situation at openstreetmap-carto?

If we default to Chinese glyph forms, then also Japanese city names will be rendered with Chinese glyph forms, and Japanese people will feel like it is a Chinese map. If we default to Japanese glyph forms, then also Korean city names will be rendered with Japanese glyph forms, and Korean people will feel like it is a Japanese map…

Current defaults:

What is necessary for a better solution?

1. Knowledge about the target language/script/region of each label

2. A way to get Mapnik actually render the correct localized fonts

clkao commented 8 years ago

Is it possible to add some sort of regional specific selector (based on country or bbox) as cartocss extension? I think that's the basic facility required for using different glyph forms for their respective regions when preferred language is unspecified.

The default rendering should be using the region-specific glyph forms, assuming name is in that language. And when generating Chinese-version tiles (preferring name:zh) there should be overriding styles using the Chinese glyph forms.

mxa commented 8 years ago

I'm not sure, but the biggest issues for the map might be between Traditional Chinese and Japanese. Maybe also for traditional (Taiwan) vs. simplified (Mainland China) Chinese. The map for Korea has almost no place names with Chinese characters, They are all in Hangeul and there is no overlap with Chinese or Japanese. However, some objects in Korea have Hanja names too. It usually is in the name:zh tag, which is wrong, but there is no better proposal. See this discussion https://lists.openstreetmap.org/pipermail/talk-ko/2015-October/000228.html

pnorman commented 8 years ago

Is it possible to add some sort of regional specific selector (based on country or bbox) as cartocss extension? I think that's the basic facility required for using different glyph forms for their respective regions when preferred language is unspecified.

Not within CartoCSS as it exists now. If it got added we could consider using it.

It's possible to do something with more complicated SQL queries, but this gets messy, and is even messier without defining functions in PostgreSQL, which we avoid.

pnorman commented 8 years ago

And when generating Chinese-version tiles (preferring name:zh) there should be overriding styles using the Chinese glyph forms.

Chinese-specific tiles would require modifying the style, so modifying the font list for a better rendering is pretty easy for someone to do once they've started modifications.


fwiw, I think we're stuck with the Han unification problems with current technologies.

sommerluk commented 8 years ago

Unicode 9.0.0 core specification http://www.unicode.org/versions/Unicode9.0.0/UnicodeStandard-9.0.pdf has an implementation guideline about language information in plain text and especially Han unification: Chapter 5.10.

pnorman commented 8 years ago

Han unification: Chapter 5.10.

I've read over it and it doesn't help much. In the situations they describe there is implicit language information by the reader being either Japanese or Chinese and having corresponding fonts. With server-side rendering (and most client-side) the fonts are supplied so none of the scenarios are what we have.

I do note that "plain text remains legible in the absence [of format specifications]"

mboeringa commented 8 years ago

I do note that "plain text remains legible in the absence [of format specifications]"

And:

"The goal and methods of Han unification were to ensure that the text remained legible."

"There should never be any confusion in Unicode, because the distinctions between the unified characters are all within the range of stylistic variations that exist in each country."

Artoria2e5 commented 7 years ago

Some improvements may be possible based on 5e5fb3b by reducing JP coverage to the Noto/Source Han Sans subset font, and padding it up with a SC or TC variant that has all the glyphs. This way all characters used by Japanese would be made Japanese, while the rest can be left to be written in the Chinese ways.

Correction for my comment in #2608: It appears that Japanese, for example, don't quite use the character "门": https://ja.wiktionary.org/wiki/%E9%97%A8. Since it's possibly still in the subset file (according to the source han sans readme the subset still covers all the JIS X characters), someone may have to do some font editing to kick it out.

sommerluk commented 7 years ago

Since it's possibly still in the subset file […], someone may have to do some font editing to kick it out.

@Artoria2e5 If I understand you correctly, the proposal with the region-specific subsets is not a solution for our problem, right?

sommerluk commented 7 years ago

I’ve made some further investigations and updated the issue description (“first comment”).

It seems to me that the only reliable way to support this is having in the OSM database itself the information about the language that was used in the name tag.

Artoria2e5 commented 7 years ago

@sommerluk Taking subsets can be a good enough solution as you can isolate characters not (usually) used by one region and give it a writing style from a region that commonly uses it. The region subset files can appear quite a bit too inclusive for any given region though.

Name tagging is the ideal solution around this.

springmeyer commented 7 years ago

It seems to me that the only reliable way to support this is having in the OSM database itself the information about the language that was used in the name tag.

This could be paired nicely with Mapnik if Mapnik were extended to dynamically read this value in from the database and pass it to harfbuzz. I've sketched out how that could work at https://github.com/mapnik/mapnik/issues/3655#issuecomment-296358008.

jojo4u commented 7 years ago

Using a name_lang=[lang code] tag or similar would solve the Han problem and the duplication of name tags by because the name:[local lang code]=[local name] tag could be omitted.

sommerluk commented 7 years ago

@springmeyer Thanks!

sommerluk commented 7 years ago

I’ve written a proposal for language information tagging at https://wiki.openstreetmap.org/wiki/Proposed_features/Language_information_for_name

Feedback is welcome.

nebulon42 commented 7 years ago

@sommerluk I have thought about something similar, but limited to multilingual names: https://wiki.openstreetmap.org/wiki/User:Nebulon42/Multilingual_names

Maybe something there is of value for this problem. Or vice versa :)

sommerluk commented 7 years ago

@nebulon42 Thanks! I did not know your proposal. Great work!

The syntax is essentially the same: semicolon-separated list of the language codes that are already used for name:=

Additional to your proposal, I simply admit single-language values. Would you consider that my proposal is a superset of your proposal and would be enouth to also serve your purposes?

nebulon42 commented 7 years ago

I did not know your proposal.

Yes, I drafted it some time ago but did not have the time to push it further.

Would you consider that my proposal is a superset of your proposal and would be enouth to also serve your purposes?

Definitely. If you have the time and energy to push this further I really appreciate that. If you need some help please tell me. If anything on my Wiki page suits your needs for the proposal like the example renderings etc. please do not hesitate to use it.

I saw that there is some progress on the Mapnik side. If there is anything that needs to be done for CartoCSS, please create an issue and I will try to get it into the next release.

sommerluk commented 7 years ago

Yes, that sounds good.

The RFC at the tagging mailing list is done. The multilingual name processing is added as use case. Overall, the proposal is still quite short, also because my english is not so good. Hopefully that’s not an obstacle…

About Mapnik and CartoCSS: The most important part is getting support for controling locl via a property in the stylesheet. As far as I know, that’s not done yet. Once it’s done, will it be automatically available in CartoCSS, or is it necesarry to add in manually?

nebulon42 commented 7 years ago

If it's only about the property then adding it to https://github.com/mapnik/mapnik-reference for 3.1.0 or which version it is released in would be sufficient. Then carto needs to used that updated reference in a new version and it is available.

sommerluk commented 7 years ago

The voting for a language tag is now open at https://wiki.openstreetmap.org/wiki/Proposed_features/Language_information_for_name

Support is welcome ;-)

kocio-pl commented 6 years ago

There's a current proposition for determining languages of a name tags:

https://wiki.openstreetmap.org/wiki/Key:default_language

pnorman commented 6 years ago

If Mapnik <TextSymbolizer> gets locl support and it makes it into CartoCSS, we'd still have to think hard about it. This would add a decent amount of complexity to the SQL and bump the minimum Mapnik version to 3.1.0 (or something more recent if it takes longer)

c933103 commented 5 years ago

iirc the "beta" character in Greek also have some similar situation? Is there any exhaustive list on all language/script/glyph that are affected by the Unicode glyph unification?

sommerluk commented 5 years ago

iirc the "beta" character in Greek also have some similar situation? Is there any exhaustive list on all language/script/glyph that are affected by the Unicode glyph unification?

To both questions: I don’t know, neither did I found a good answer searching on the web.

bdon commented 4 years ago

Working on Step 2 above here: https://github.com/mapnik/mapnik/issues/3655#issuecomment-678532685

For Step 1, my feeling is that for the zh-hant locale this problem is so pervasive that an OSM data based approach isn't realistic - essentially any character that uses the 辶 radical is affected including common names of linear features like 大道(Boulevard), 步道(Trail), etc. (before/after using my lang fork:)

Screen Shot 2020-08-21 at 5 49 27 PM Screen Shot 2020-08-21 at 5 49 49 PM

For the region-based approach, I'm skeptical that a polygon-based approach will result in an elegant implementation; what about a raster/bitmap solution? For example, a GeoTiff where each pixel encodes an 8-bit value corresponding to BCP47 language tag that can be sampled for every symbolizer - for my own uses I would probably implement this in-memory directly in the mapnik C++ code, but for OSM Carto I'm not sure how this would fit into the tile rendering path.

A bitmap based approximation based on Z14 tiles might be detailed enough and would be 16384x16384 px, which is a reasonable size.