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

Incorrect line height for labels containing Tibetan scripts #4834

Closed
ztzthu opened this issue Jun 28, 2023 · 6 comments
Closed

Incorrect line height for labels containing Tibetan scripts #4834

ztzthu opened this issue Jun 28, 2023 · 6 comments
Labels

Comments

@ztzthu
Copy link

ztzthu commented Jun 28, 2023

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
Copy link
Collaborator

imagico commented Jul 2, 2023

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.

@imagico imagico added the text label Jul 2, 2023
@ztzthu
Copy link
Author

ztzthu commented Jul 3, 2023

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
Copy link
Collaborator

pnorman commented Jul 3, 2023

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
Copy link
Author

ztzthu commented Jul 3, 2023

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
Copy link
Collaborator

Please take a look at these links:

notofonts/tibetan#23

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

In short:

  • The default line height in Noto is chosen according to the maximum stack height. Maximum stack height means that you have normal characters, and then accents are added above or below those characters, which requires more space. That is in general a useful approach to avoid line to “touch” each other when accents are used.
  • Apparently the maximum stack height is big for Tibetan (I do not know the details of this script, but this is described in the issue mentioned above.) This results in the big line height of Noto Serif Tibetan.
  • The line height differs between different Noto fonts: Noto Serif Tibetan has a different line height than Noto Sans than Noto Sans Hebrew. This is by design and in general also very useful to get the line height right in multi-script contexts.
  • In typography, usually longer lines get bigger line heights and shorter lines smaller line heights. In this example, the line is quite short, which makes the big line height of Noto Serif Tibetan more outstanding, contributing to the visually unpleasant result.
  • Jomolhari would not really be an alternative. We use Noto to guarantee a uniform design across different scripts, this would break when we use fonts with different designs. Furthermore, the glyphs of Jomolhari are significantly smaller than Latin glyphs. This would look odd and be bad for readability. And technically, we are not able to raise the point size for only Jomolhari without raising the point size also for all other fonts. (This is a limitation of our software stack.) Therefore, Jomolhari would always look “too small”.

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
Copy link
Author

ztzthu commented Jul 5, 2023

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.

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

No branches or pull requests

4 participants