mirror of
https://github.com/servo/servo
synced 2026-05-14 19:06:31 +02:00
## Motivations This PR improves fallback font algorithm for Japanese documents on macos and Linux. For Japanese documents, we generally use a same font for Hiragana/Katakana/Kanji(Han). Since their is a fallback algorithm to render serif fonts for `Script::Han`in current implementation, it gives unnatural reading experience for Japanese users. ## Changes To achieve above, - added `lang` field to `FallbackFontSelectionOptions` struct - pass `_x_lang` from text_run in layout component ## Screenshots rendering https://ja.wikipedia.org/wiki/Servo <table> <thead> <tr> <th>before fixed</th> <th>after fixed</th> </tr> </thead> <tbody> <tr> <td> <!-- before fixed --> <img width="545" height="168" alt="CleanShot 2025-10-01 at 23 08 24" src="https://github.com/user-attachments/assets/9ad7ccb0-729a-49ad-b8ce-88b1d78a2705" /> </td> <td> <!-- after fixed --> <img width="474" height="139" alt="CleanShot 2025-10-01 at 23 07 16" src="https://github.com/user-attachments/assets/010e8052-5a10-48e1-8367-ff29a5632d0f" /> </td> </tr> </tbody> </table> --------- Signed-off-by: araya <araya@araya.dev>