Edited: 9/8, Add English version
Have you ever paid attention to the shape of texts?
Maybe, you've heard about Serif or Sans-Serif . whether there are small lines or strokes attached to the ends of strokes. There are various fonts in alphabet.
In addition, this can be applied to other languages. Alphabet, Hiragana/Katakana/Kanji, Hangul, Chinese, Arabic...
Today, I'll talk about how I've struggled with fonts on a multilingual site
Simply put, there are three points.
- font metrics
- supported character types
- file transfer size
font metrics
About this, seeing is better than reading.
This is sample text. これは、サンプルテキストです。
This is a sample of text where the "Noto Sans JP" font—normally used by this site by default—has been removed, and a font commonly used as the browser default has been specified instead. Depending on your viewing environment, it will likely look quite different.
As an example, in my environment, it looks like this.
Doesn't the line of Japanese text look a bit weak?
The difference in atmosphere comes from font design, while the misalignment of characters is due to differences in font metrics.
Difference of design comes from the difference of "cool", "easy to read" shapes among languages, and this causes the difference of impression.
Differences in font metrics come from character structure. For example, alphabet has character which protrude from the bottom (like g, j, p, q, y), so baseline setted a bit higher than other languages.
Therefore, using same font families as possible is better. I think. However then, the next problem surfaces.
supported character types
Each fonts has supported character ranges. We can't display Japanese Kana or Kanji in English-only fonts and display arabic in English and Japanese-only fonts.
To fill unsupported characters, special characters like "□" or "☒" displayed. These called as "tofu", used to describe that the computer knows what this character is, but doesn't know how to display it. A long time has passed since they disappeared
To summarize, if we want to use same font family among different languages, we have to use fonts that supports all of languages used.
Honestly, such fonts are rare. most fonts are only alphabets, or alphabet + another language. We can't consider to use.
To solve this problem, Noto Sans JP used in this blog. That includes Japanese Hiragana, Katakana, Kanji, and Alphabets, numbers, symbols.
This font were created for "No more tofu", there is variations like Noto Sans CJK(Chinese、Japanese、Korean), or Noto Sans Arabic.
As fonts in the same family, they share the same metrics and on display,
This is sample text. これは、サンプルテキストです。
it doesn't cause misalignment and difference of atmosphere. Allowing this blog to switch language very smoothly.
However, it is too early to be relieved. These multi-language fonts have another problem.
file transfer size
Font files are too large.
It makes sense when you think about it, Japanese has a large amount of Kanji. To display all of them, a large amount of data required. For example, Noto Sans JP includes about 44.8k characters! File I downloaded from Google Fonts was 8.9MB. If we loading from CDN, it also requires an extra connection/handshake. First Contentful Paint gets worse, and Score of PageSpeed Insights plummeted (speaking from painful experience).
To solve this, make file lighter by removing unused characters (subsetting) or woff2 compressing, but they're too troublesome. Thinking about large sites, it seems to be difficult to control character ranges, so I wonder how to support multi-language.
Actually, the opportunity to write this article is that I finished moving fonts from Google Fonts API to Self hosting and subsetting previously. I'll write another article about specific trial and error if I feel like it. Shortly, Performance(Mobile) Score rises from 85 to 86, FCP improved from 2.8s to 2.3s. Ummm, improvement too small. It sounds nice if I said 18% improvement, isn't it?
No? I'll put in more effort...
conclusion
In conclusion, I have broken down and analyzed the traps found in running multi-lingual site.
For those who simply browse websites, this might offer just a fleeting thought—"I had no idea there was so much involved." and for those currently managing multilingual sites—or planning to do so—I hope this serves as a guidepost, helping you move forward by learning from the struggles I’ve endured.
Today's article is now over. Thank you for reading!