Modify loadFont to fit in nonExplicitSupportedLngs

'ko-KR' or 'ko' is loaded browser by browser, in any case font will be loaded.
This commit is contained in:
Mr.WaterT 2024-05-22 02:51:04 +09:00
parent 44832eb709
commit 9c830de743

View File

@ -71,15 +71,14 @@ const alternativeFonts = {
} }
function loadFont(language: string) { function loadFont(language: string) {
Object.keys(alternativeFonts).forEach(l => { let altFontLanguages = Object.keys(alternativeFonts);
if (language == l) { if (!alternativeFonts[language]) { language = language.split(/[-_/]/)[0]; }
alternativeFonts[l].forEach(f=> { document.fonts.add(f); }); if (alternativeFonts[language]) {
} alternativeFonts[language].forEach(f => { document.fonts.add(f); });
else { altFontLanguages.splice(altFontLanguages.indexOf(language), 0);
alternativeFonts[l].forEach(f=> { }
if (f && f.status == "loaded") { document.fonts.delete(f); } altFontLanguages.forEach(f=> {
}); if (f && f.status == "loaded") { document.fonts.delete(f); }
}
}); });
} }