gravitystorm / openstreetmap-carto

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

Incorrect line height for labels containing Tibetan scripts #4834

Closed ztzthu closed 1 year ago

ztzthu commented 1 year ago

The title pretty much says itself. When a label contains Tibetan scripts, the line height will be excessively large. Normally this is not a problem but when the label is long and has to be wrapped, it will look like two separate lines.

Examples:

https://www.openstreetmap.org/node/3316196457#map=11/29.2654/88.9158 (in Tibet, China)

image

https://www.openstreetmap.org/#map=15/26.8644/90.2656 (in Bhutan)

image

While Tibetan, Laos, Thai and Myanmar scripts do need taller line height, this excessive line height is not observed in Laos, Thailand or Myanmar. A good Tibetan layout example from the Tibetan wiki page, where approapriate line height is used:

image

Could be related to #2338, #3512.

imagico commented 1 year ago

My understanding is that this is an issue that stems from the design of the font we use (Noto) and not something we can easily adjust from the style specifically for one type of script. Maybe @sommerluk has more insights.

ztzthu commented 1 year ago

Thanks for the insight, seem that indeed the problem lies in the font but not the rendering algorithms.

The issue #2358 seems to have a lot of good discussions on this topic: In a similar case of Myanmar language, the Noto Sans Myanmar UI font is used instead of Noto Sans Myanmar font. The UI font ensures that the same line height is shared across different languages.

The current Tibetan font is Noto Serif Tibetan, and seems that it does not have a UI font version. Can we have a workaround ? The excessive line height does pose a problem i believe.

pnorman commented 1 year ago

The current Tibetan font is Noto Serif Tibetan, and seems that it does not have a UI font version. Can we have a workaround ? The excessive line height does pose a problem i believe.

What work-arounds are you aware of? There's very little we can change within OpenStreetMap Carto to fix these kinds of issues.

ztzthu commented 1 year ago

One of the possible ways is to use Jomolhari font instead of Noto Serif Tibetan font:

https://fonts.google.com/specimen/Jomolhari/about

It is also liscenced under the Open Font License. As far as I know this is the default font for Tibetan used by Wikipedia, according to their css style sheet:

.mw-parser-output .uchen {
     font-family: "Jomolhari","Uchen","Noto Serif Tibetan Medium","Noto Serif Tibetan","BabelStone Tibetan Slim","Yagpo Tibetan Uni","Noto Sans Tibetan","Microsoft Himalaya","Kailash","DDC Uchen","TCRC Youtso Unicode","Tibetan Machine Uni","Qomolangma-Uchen Sarchen","Qomolangma-Uchen Sarchung","Qomolangma-Uchen Suring","Qomolangma-Uchen Sutung","Qomolangma-Title","Qomolangma-Subtitle","DDC Rinzin","Qomolangma-Woodblock","Qomolangma-Dunhuang"
}

But in their usecase, when used inline the font size is altered as well, so not sure if this is a good workaround.

font-size:1.25em; vertical-align:middle; word-wrap:break-word;

IMHO in the usecase of osmcarto the glyphs should still be recognizable with default 1em font size tho.

sommerluk commented 1 year ago

Please take a look at these links:

https://github.com/notofonts/tibetan/issues/23

https://googlefonts.github.io/gf-guide/metrics.html

In short:

So though the current situation is not ideal for Tibetan in particular, there are good reasons why the things are like they are in general, and possible workarounds would introduce other problems which would make the situation in general worse.

ztzthu commented 1 year ago

So though the current situation is not ideal for Tibetan in particular, there are good reasons why the things are like they are in general, and possible workarounds would introduce other problems which would make the situation in general worse.

Sorry to comment the issue again. Simply explaining why things are like they are and ingoring what things should be like does not help solve the problem.

In addition to Noto Serif Tibetan and Jomolhari, there is also the free Uchen font: https://fonts.google.com/specimen/Uchen

This font does not have excessive line height like Noto Serif Tibetan, nor does it have small glyphs like Jomolhari, it could be a good candidacy for Tibetan fonts.

image

We use Noto to guarantee a uniform design across different scripts, this would break when we use fonts with different designs.

Do we have a very solid reason for using Noto fonts ? It is just a collection of different fonts after all. And obviously we are ALREADY breaking the rules here by using Serif font instead of Sans font for Tibetan scripts (this is the only Serif font used in osmcarto). I don't think that not using this specific font of Noto Serif Tibetan will make the situation worse.

What is indeed worse is that, as the OSM China community is improving the multilingual tagging in Tibet, this issue of excessive line height will become more and more common.