Add some CJK fonts for windows

This commit is contained in:
Jeremy Soller 2022-10-13 14:20:05 -06:00
parent dc50b6935b
commit 3552abdcbb
No known key found for this signature in database
GPG key ID: 87F211AF2BE4C2FE

View file

@ -12,6 +12,24 @@ pub fn common_fallback() -> &'static [&'static str] {
]
}
fn han_unification(locale: &str) -> &'static [&'static str] {
//TODO!
match locale {
// Japan
"ja" => &[],
// Korea
"ko" => &[],
// China
"zh-CN" => &[],
// Hong Kong
"zh-HK" => &[],
// Taiwan
"zh-TW" => &[],
// Simplified Chinese is the default
_ => &[],
}
}
// Fallbacks to use per script
pub fn script_fallback(script: &Script, locale: &str) -> &'static [&'static str] {
//TODO: better match https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/platform/fonts/win/font_fallback_win.cc#L99
@ -20,10 +38,14 @@ pub fn script_fallback(script: &Script, locale: &str) -> &'static [&'static str]
Script::Canadian_Aboriginal => &["Gadugi"],
Script::Cherokee => &["Gadugi"],
Script::Devanagari => &["Nirmala UI"],
Script::Ethiopic => &["Ebrima"],
Script::Gujarati => &["Nirmala UI"],
Script::Gurmukhi => &["Nirmala UI"],
Script::Han => han_unification(locale),
Script::Hangul => &["Malgun Gothic"],
Script::Hiragana => &["Meiryo"]
Script::Kannada => &["Nirmala UI"],
Script::Katakana => &["Meiryo"]
Script::Khmer => &["Leelawadee UI"],
Script::Lao => &["Leelawadee UI"],
Script::Malayalam => &["Nirmala UI"],