From cb561ddef8c0119ea342c996e9a4b516562e23cf Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Thu, 13 Jul 2023 17:11:59 -0700 Subject: [PATCH] fix: :lipstick: different default font if cjk --- packages/backend/src/server/web/boot.js | 8 ++++++-- packages/client/src/style.scss | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/server/web/boot.js b/packages/backend/src/server/web/boot.js index d3b7c3b82..9c966036f 100644 --- a/packages/backend/src/server/web/boot.js +++ b/packages/backend/src/server/web/boot.js @@ -102,7 +102,11 @@ localStorage.setItem("fontSize", null); 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"); @@ -123,7 +127,7 @@ } async function addStyle(styleText) { - let css = document.createElement("style"); + const css = document.createElement("style"); css.appendChild(document.createTextNode(styleText)); document.head.appendChild(css); } diff --git a/packages/client/src/style.scss b/packages/client/src/style.scss index 9df882ec7..6d24f5ad7 100644 --- a/packages/client/src/style.scss +++ b/packages/client/src/style.scss @@ -39,7 +39,7 @@ html { accent-color: var(--accent); overflow: auto; overflow-wrap: break-word; - font-family: "BIZ UDGothic", Roboto, HelveticaNeue, Arial, sans-serif; + font-family: Roboto, HelveticaNeue, Arial, sans-serif; font-size: 14px; line-height: 1.6; text-size-adjust: 100%; @@ -47,6 +47,10 @@ html { scroll-padding: 60px; overflow-x: clip; + &.useCJKFont { + font-family: "Hiragino Maru Gothic Pro", "BIZ UDGothic", Roboto, HelveticaNeue, Arial, sans-serif; + } + &.useSystemFont { font-family: system-ui,