fix: 💄 different default font if cjk

This commit is contained in:
ThatOneCalculator 2023-07-13 17:11:59 -07:00
parent 5d38558e8a
commit cb561ddef8
No known key found for this signature in database
GPG key ID: 8703CACD01000000
2 changed files with 11 additions and 3 deletions

View file

@ -102,7 +102,11 @@
localStorage.setItem("fontSize", null); localStorage.setItem("fontSize", null);
fontSize = localStorage.getItem("fontSize"); fontSize = localStorage.getItem("fontSize");
} }
document.documentElement.style.fontSize = fontSize + "px"; document.documentElement.style.fontSize = `${fontSize}px`;
}
if (["ja-JP", "ja-KS", "ko-KR", "zh-CN", "zh-TW"].includes(lang)) {
document.documentElement.classList.add("useCJKFont");
} }
const useSystemFont = localStorage.getItem("useSystemFont"); const useSystemFont = localStorage.getItem("useSystemFont");
@ -123,7 +127,7 @@
} }
async function addStyle(styleText) { async function addStyle(styleText) {
let css = document.createElement("style"); const css = document.createElement("style");
css.appendChild(document.createTextNode(styleText)); css.appendChild(document.createTextNode(styleText));
document.head.appendChild(css); document.head.appendChild(css);
} }

View file

@ -39,7 +39,7 @@ html {
accent-color: var(--accent); accent-color: var(--accent);
overflow: auto; overflow: auto;
overflow-wrap: break-word; overflow-wrap: break-word;
font-family: "BIZ UDGothic", Roboto, HelveticaNeue, Arial, sans-serif; font-family: Roboto, HelveticaNeue, Arial, sans-serif;
font-size: 14px; font-size: 14px;
line-height: 1.6; line-height: 1.6;
text-size-adjust: 100%; text-size-adjust: 100%;
@ -47,6 +47,10 @@ html {
scroll-padding: 60px; scroll-padding: 60px;
overflow-x: clip; overflow-x: clip;
&.useCJKFont {
font-family: "Hiragino Maru Gothic Pro", "BIZ UDGothic", Roboto, HelveticaNeue, Arial, sans-serif;
}
&.useSystemFont { &.useSystemFont {
font-family: font-family:
system-ui, system-ui,