Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(web): follow the OS locale for system Han glyphs

tianma-if23b6d3eb0273
diff --git a/apps/web/src/styles/editor-typography.test.mjs b/apps/web/src/styles/editor-typography.test.mjs
index e146e3a5..744421cb 100644
--- a/apps/web/src/styles/editor-typography.test.mjs
+++ b/apps/web/src/styles/editor-typography.test.mjs
@@ -151,6 +151,28 @@ describe("editor typography contract", () => {
}
});
+ test("lets the system font follow the OS locale for Han glyphs", () => {
+ const globals = readStyle("./globals.css");
+ const mobileEditor = readStyle("./mobile-markdown-editor.css");
+ const systemStack =
+ '-apple-system, BlinkMacSystemFont, "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif';
+ const regionFaces = ["PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC"];
+ const fontSans = globals.match(/--font-sans:\s*([^;]+);/)?.[1];
+ const systemFamily = globals.match(/--edgeever-system-font-family:\s*([^;]+);/)?.[1];
+
+ expect(fontSans).toBe(systemStack);
+ expect(systemFamily).toBe(systemStack);
+ for (const face of regionFaces) {
+ expect(fontSans).not.toContain(face);
+ }
+
+ const mobileDiagramText = declarationsForSelector(mobileEditor, ".edgeever-mermaid-svg text");
+ expect(mobileDiagramText).toContain("var(--edgeever-system-font-family,");
+ for (const face of regionFaces) {
+ expect(mobileDiagramText).not.toContain(face);
+ }
+ });
+
test("does not let preset themes override table geometry", () => {
const geometryPattern =
/(?<![\w-])(?:padding|min-width|max-width|min-height|max-height|line-height|table-layout|width|height)(?:-[a-z]+)?\s*:/;
diff --git a/apps/web/src/styles/globals.css b/apps/web/src/styles/globals.css
index 5b7555fc..03b5b99f 100644
--- a/apps/web/src/styles/globals.css
+++ b/apps/web/src/styles/globals.css
@@ -10,7 +10,8 @@
@custom-variant dark (&:where(.dark, .dark *));
@theme inline {
- --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Inter, ui-sans-serif, system-ui, sans-serif;
+ /* Named CJK families would claim every shared Han character and pin one region's glyphs. */
+ --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
--font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--shadow-panel: 0 1px 2px rgb(var(--slate-900-rgb) / 0.05), 0 16px 40px rgb(var(--slate-900-rgb) / 0.07);
/* Tailwind 4 shifted shadow-sm and blur-sm up one step. Keep the weights this UI shipped with. */
@@ -361,7 +362,7 @@
--blue-600-rgb: 37 99 235;
--dark-surface-rgb: 255 255 255;
--editor-body-font-size: 1rem;
- --edgeever-system-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Inter, ui-sans-serif, system-ui, sans-serif;
+ --edgeever-system-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
--editor-body-line-height: 1.65;
--editor-paragraph-spacing: 0.35rem;
--memo-content-divider-color: #1a1d21;
diff --git a/apps/web/src/styles/mobile-markdown-editor.css b/apps/web/src/styles/mobile-markdown-editor.css
index 4f3f40b1..7dc2e5a6 100644
--- a/apps/web/src/styles/mobile-markdown-editor.css
+++ b/apps/web/src/styles/mobile-markdown-editor.css
@@ -779,7 +779,7 @@ html.dark .edgeever-mobile-tiptap-content a:hover {
}
.edgeever-mobile-tiptap-content .edgeever-mermaid-svg text {
- font-family: var(--editor-body-font-family, var(--edgeever-system-font-family, -apple-system, "PingFang SC", "Noto Sans SC", sans-serif));
+ font-family: var(--editor-body-font-family, var(--edgeever-system-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", ui-sans-serif, system-ui, sans-serif));
font-synthesis: weight;
}