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

[Improvement Request] Ruby Annotation element does not performing well with some font #5403

Open
larachung opened this issue Feb 17, 2023 · 2 comments

Comments

@larachung
Copy link

Ruby character or Rubi character is very common in East Asian language which placed smaller characters above, under or to the right of CJK characters (Chinese, Japanese and Korean) to show the pronunciation. In HTML there are Ruby elements to display ruby characters.

Sample:

<ruby>超電磁砲<rp>(</rp><rt>レールガン</rt><rp>)</rp>超電磁砲レールガン
<ruby>超電磁砲<rp>(</rp><rt>Railgun</rt><rp>)</rp>超電磁砲Railgun

A setence with normal ruby should look like these.
Vertical: image
Horizontal: image

But if the user is using some font with line-height significantly higher than glyph height (Like Source Han Family and PingFang Family which are very common CJK fonts), Firefox displays it like the picture below. Because the line-height of the font is too high, the space between the main character and ruby character is too large, (Incidentally, Safari has the same problem, but Google Chrome can handle this space properly). This is very bad for East Asian language, because the ruby character will propped up the line space.

The ruby character makes the space between the first line and second line far larger than the others, which is bad for Japanese display:
image

The sample with Source Han Serif under latest Firefox (the space between 超電磁砲 and レールガン is too large):
image

The sample with Source Han Serif under Google Chrome:
image

Ruby character is very important in East Asian language, and there are many common CJK fonts(For example, PingFang Family is the default Chinese fonts in Apple devices) with high line height. So, there will have a very negative impact on Asian Firefox users, if Firefox cannot handle the space between ruby characters and main text when the users is using a font has higher line-height than glyph height like Source Han Serif or PingFang TC.

@mozilla mozilla deleted a comment from devilshezi0 Apr 3, 2023
@akatsoulas akatsoulas moved this to ❓ triage in Mozilla Support Jul 17, 2023
@bewizible
Copy link

@larachung Hey there, have you figured out any workaround to this? This has been irritating me too since I started to use firefox

@larachung
Copy link
Author

@larachung Hey there, have you figured out any workaround to this? This has been irritating me too since I started to use firefox

Here is a trick, use another font with low line-height in the font fallback list. For example:

@font-face {
  font-family: "Boston";
  src: local("Boston") format('TrueType');
  unicode-range: U+20;
}

body {
  font-family: "Boston", "Source Han Sans";
}

This CSS will use the information from Boston, and not affect the glyphs of Source Han Sans(except U+20, the space character). However, as you can see, this trick has limitations—you can’t customize the CSS everywhere.

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

No branches or pull requests

2 participants