fix: improve Japanese typography (lang attribute and font fallback) #706
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes a small typography-related improvement.
Thank you again for the recently added Japanese language support.
From a Japanese native reader’s perspective, when page language metadata and Japanese-appropriate font fallbacks are missing, text can appear readable but slightly “off” due to glyph variant mismatches. This PR aims to address that subtle issue.
Changes
th:lang):lang(ja)These changes help browsers select the correct glyph variants for Japanese text.
About alternatives
If bundle size is a concern, a lighter alternative would be to avoid embedding fonts and only specify common Japanese system fonts as fallbacks.
This PR prioritizes visual consistency and quality, but the approach can be adjusted depending on the project’s design and size constraints.
Additional notes
This improvement is specifically intended to polish the newly added Japanese localization.
Background on the glyph-variant issue (with examples):
https://heistak.github.io/your-code-displays-japanese-wrong/