readium / readium-css

🌈 A set of reference stylesheets for EPUB Reading Systems, starting with Readium Mobile
https://readium.org/readium-css/
BSD 3-Clause "New" or "Revised" License
89 stars 20 forks source link

Fix japanese font settings #146

Closed peaceroad closed 2 weeks ago

peaceroad commented 1 month ago

Please check if the PR fulfills these requirements:

What kind of change does this PR introduce? (Bug fix, feature, docs update, other)

In a Japanese Windows environment in Thorium Reader, I will change the font-family to be applied preferentially from MS Font to BIZ UD font.

To do this, I did the following:

What is the current behaviour? (You can also link to an open issue here)

When using the current Thorium Reader on Windows, if you apply each font in "Extra variables for Japanese font-stacks" in the text font settings that can be set after changing the UI language to "Japanese", it will become an MS font. MS fonts are a bit rough, so I think the reading experience using this font is a bit subtle.

ex. https://github.com/edrlab/thorium-reader/issues/2353#issue-2316639998

What is the new behaviour?

I changed the font name settings in various ways, but the behavior change should only apply to Windows. And in Thorium Reader, it should be displayed in BIZ UD font with anti-aliasing enabled.

ex. https://github.com/edrlab/thorium-reader/pull/2252#issuecomment-2130699644

(I haven't confirmed that Thorium works on macOS.)

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

I don't think it will be a problem in the app.

Other information:

Some people think that Yu fonts are better than BIZ UD fonts, so it's a bit difficult to decide whether to prioritize BIZ UD (BIZ UD has less space after punctuation marks). However, in this pull request, I chose the BIZ UD font, which is displayed clearly, because the default Yu font on Windows is displayed a little thin. Therefore, I may choose to change the priority font order in the future.

Example of Yu/BIZ UD display in Chrome browser (image attached): https://codepen.io/peaceroad/pen/dyEOVdr image

One thing to note in particular is that in vertical writing mode using the BIZ UD font, half-width ASCII characters are displayed narrowly, so if you look at only this part, the Yu font may be slightly easier to read. (Looking at this issue alone, it can be avoided by changing the setting from BIZ UD to BIZ UDP, but I didn't know if that was a good idea, so I didn't do that.)

Also, since I don't usually use macOS, there may be a better setting.

peaceroad commented 1 month ago

Example of Yu/BIZ UD display in Chrome browser (image attached):

Sorry. I forgot to change it back when I was checking, so in vertical writing mode, the image specified BIZ UDPMincho instead of BIZ UDMincho. I also updated the commit.

The result displayed with BIZ UDMincho is attached below.

image

JayPanoz commented 1 month ago

Thank you, this is an outstanding summary of the changes. This is greatly appreciated and helps a lot.

I will review as soon as possible but there shouldn’t be any issue at first sight – we also have an engineering call on Wednesday to discuss it with implementers if needed but it mainly impacts Daniel and he already chimed in.

peaceroad commented 1 month ago

Since then.

I thought it would be better to use BIZ UD font. However, in Windows, Yu Font's sans serif type (Gothic) also comes pre-installed with a font called "Yu Gothic Medium" with a weight of 500. I didn't check this properly. After that, I thought about using this font for sans serif. This will solve the problem of vertical ASCII characters in BIZ UD fonts being difficult to read.

https://codepen.io/peaceroad/pen/dyEOVdr

use-san-serif-font-to-yu-medium

I'll commit it later.

In addition, Yu Font's serif type font with weight 500 (Yu Mincho Medium) is not installed in Windows. Therefore, I think I'll leave the setting of displaying BIZ UD font for serif type as it is.

JayPanoz commented 2 weeks ago

LGTM. Thanks again! That’s a very valuable contribution as we are less familiar with CJK in general, and every input helps. 👍

peaceroad commented 2 weeks ago

Thanks for merging. After Thorium Reader with this implementation is released, I'll submit another pull request if I find any issues or can specify better font settings.