railmapgen / rmp

Design your own rail map by freely dragging stations from different cities and connecting them with 135-degree rounded corners or perpendicular lines!
https://railmapgen.github.io/?app=rmp
GNU General Public License v3.0
90 stars 18 forks source link

Add fallback fonts for Chinese and English #553

Open thekingofcity opened 8 months ago

thekingofcity commented 8 months ago

This should help #530.

Google Noto Sans might be a great option for Chinese.

wongchito commented 6 months ago

Refer to railmapgen/railmapgen.github.io#80

From the platform's point of view, we recommend user to download those needed free fonts in advance to reduce network traffic and speed up loading. With the local fonts, we don't need to inject any Base64 fonts in CSS and it will just work in both browser and Adobe Illustrator.

IMHO I don't think adding extra non-native fonts is a good idea as we can't guarantee Google Noto Fonts are pre-installed. Also, these fonts are not officially used in any current styles, so there's no difference between falling back to SimHei (PingFang in iOS/macOS) and to Google Noto Fonts.

Please try this feature out in 'Runtime Demo' app with devtools on in settings panel and give any advice on it. :)

thekingofcity commented 6 months ago

Sorry for the ambiguity. By fallback fonts, I mean hosting a font but ranking it at the end of the font-family. This should help users who do not have a Chinese font be able to see the characters.

These fallback fonts could be loaded after the load so loading speed might not be a problem. And injecting Base64 fonts and/or turning fonts into paths are still important as light users won't download those for the first few times. Of course, we will support only using local fonts on export.

Network traffic would increase, but we may stop loading them for users who have zh-cn like language tags in the browser.