Sfoglia il codice sorgente

优先使用自定义字体的数字字形;更新 --b3-font-family-emoji

Jeffrey Chen 7 mesi fa
parent
commit
2cb8226f0c

+ 2 - 2
app/appearance/themes/daylight/theme.css

@@ -26,9 +26,9 @@
     /* DejaVu Sans 包含部分黑白 emoji 字形,会覆盖其他 emoji 字体的相应字形,所以emoji字体要放前面 https://github.com/siyuan-note/siyuan/issues/13213 */
     /* DejaVu Sans 包含部分黑白 emoji 字形,会覆盖其他 emoji 字体的相应字形,所以emoji字体要放前面 https://github.com/siyuan-note/siyuan/issues/13213 */
     --b3-font-family: "Helvetica Neue", "Luxi Sans", "DejaVu Sans", "Hiragino Sans", "Segoe UI", "Tahoma", "Arial", "Other Emojis", sans-serif;
     --b3-font-family: "Helvetica Neue", "Luxi Sans", "DejaVu Sans", "Hiragino Sans", "Segoe UI", "Tahoma", "Arial", "Other Emojis", sans-serif;
     --b3-font-family-protyle: var(--b3-font-family);
     --b3-font-family-protyle: var(--b3-font-family);
-    --b3-font-family-code: "Number Glyphs", "Segoe Good Emoji", "Other SiYuan Emojis", "JetBrainsMono-Regular", mononoki, Consolas, "Liberation Mono", Menlo, Courier, monospace, var(--b3-font-family);
+    --b3-font-family-code: "Number Glyphs Of Custom Font", "Number Glyphs", "Segoe Good Emoji", "Other SiYuan Emojis", "JetBrainsMono-Regular", mononoki, Consolas, "Liberation Mono", Menlo, Courier, monospace, var(--b3-font-family);
     --b3-font-family-graph: mononoki;
     --b3-font-family-graph: mononoki;
-    --b3-font-family-emoji: "Number Glyphs", "Segoe Good Emoji", "Other Emojis";
+    --b3-font-family-emoji: "Segoe Good Emoji", "Other Emojis";
     --b3-font-family-math: KaTeX_Math;
     --b3-font-family-math: KaTeX_Math;
     --b3-font-size: 14px;
     --b3-font-size: 14px;
 
 

+ 2 - 2
app/appearance/themes/midnight/theme.css

@@ -24,9 +24,9 @@
     /* 字体 */
     /* 字体 */
     --b3-font-family: "Helvetica Neue", "Luxi Sans", "DejaVu Sans", "Hiragino Sans", "Segoe UI", "Tahoma", "Arial", "Other Emojis", sans-serif;
     --b3-font-family: "Helvetica Neue", "Luxi Sans", "DejaVu Sans", "Hiragino Sans", "Segoe UI", "Tahoma", "Arial", "Other Emojis", sans-serif;
     --b3-font-family-protyle: var(--b3-font-family);
     --b3-font-family-protyle: var(--b3-font-family);
-    --b3-font-family-code: "Number Glyphs", "Segoe Good Emoji", "Other SiYuan Emojis", "JetBrainsMono-Regular", mononoki, Consolas, "Liberation Mono", Menlo, Courier, monospace, var(--b3-font-family);
+    --b3-font-family-code: "Number Glyphs Of Custom Font", "Number Glyphs", "Segoe Good Emoji", "Other SiYuan Emojis", "JetBrainsMono-Regular", mononoki, Consolas, "Liberation Mono", Menlo, Courier, monospace, var(--b3-font-family);
     --b3-font-family-graph: mononoki;
     --b3-font-family-graph: mononoki;
-    --b3-font-family-emoji: "Number Glyphs", "Segoe Good Emoji", "Other Emojis";
+    --b3-font-family-emoji: "Segoe Good Emoji", "Other Emojis";
     --b3-font-family-math: KaTeX_Math;
     --b3-font-family-math: KaTeX_Math;
     --b3-font-size: 14px;
     --b3-font-size: 14px;
 
 

+ 9 - 3
app/src/assets/scss/component/_typography.scss

@@ -2,10 +2,16 @@
   font-family: 'JetBrainsMono-Regular';
   font-family: 'JetBrainsMono-Regular';
   src: url(../fonts/JetBrainsMono-2.304/JetBrainsMono-Regular.woff2) format('woff2');
   src: url(../fonts/JetBrainsMono-2.304/JetBrainsMono-Regular.woff2) format('woff2');
 }
 }
+/* 用户指定了字体时才添加 */
+@font-face {
+  font-family: "Number Glyphs Of Custom Font";
+  src: local("/* 用户设置的编辑器字体 */");
+  /* 数字 0-9 */
+  unicode-range: U+30-39;
+}
 @font-face {
 @font-face {
   font-family: "Number Glyphs";
   font-family: "Number Glyphs";
-  src: /* 如果设置了编辑器字体,这里应该先加载${window.siyuan.config.editor.fontFamily},但我不懂怎么弄 */
-       local("Helvetica Neue"),
+  src: local("Helvetica Neue"),
        local("Luxi Sans"),
        local("Luxi Sans"),
        local("DejaVu Sans"),
        local("DejaVu Sans"),
        local("Hiragino Sans GB"),
        local("Hiragino Sans GB"),
@@ -48,7 +54,7 @@
   font-variant-ligatures: no-common-ligatures;
   font-variant-ligatures: no-common-ligatures;
   display: flex;
   display: flex;
   flex-direction: column;
   flex-direction: column;
-  font-family: "Number Glyphs", "Segoe Good Emoji", "Other SiYuan Emojis", var(--b3-font-family-protyle);
+  font-family: "Number Glyphs Of Custom Font", "Number Glyphs", "Segoe Good Emoji", "Other SiYuan Emojis", var(--b3-font-family-protyle);
 
 
   img {
   img {
     max-width: 100%;
     max-width: 100%;

+ 1 - 1
app/src/assets/scss/protyle/_protyle.scss

@@ -344,7 +344,7 @@
   margin: 34px 16px 0 24px;
   margin: 34px 16px 0 24px;
   position: relative;
   position: relative;
   font-size: 16px;
   font-size: 16px;
-  font-family: "Number Glyphs", "Segoe Good Emoji", "Other SiYuan Emojis", var(--b3-font-family-protyle);
+  font-family: "Number Glyphs Of Custom Font", "Number Glyphs", "Segoe Good Emoji", "Other SiYuan Emojis", var(--b3-font-family-protyle);
   padding-left: 2px;
   padding-left: 2px;
   border-radius: var(--b3-border-radius);
   border-radius: var(--b3-border-radius);
 
 

+ 1 - 1
app/src/util/assets.ts

@@ -219,7 +219,7 @@ export const setInlineStyle = (set = true) => {
 .protyle-wysiwyg .li {min-height:${height + 8}px}
 .protyle-wysiwyg .li {min-height:${height + 8}px}
 .protyle-gutters button svg {height:${height}px}`;
 .protyle-gutters button svg {height:${height}px}`;
     if (window.siyuan.config.editor.fontFamily) {
     if (window.siyuan.config.editor.fontFamily) {
-        style += `\n.b3-typography:not(.b3-typography--default), .protyle-wysiwyg, .protyle-title {font-family: "Number Glyphs", "Segoe Good Emoji", "Other SiYuan Emojis", "${window.siyuan.config.editor.fontFamily}", var(--b3-font-family-protyle)}`;
+        style += `\n.b3-typography:not(.b3-typography--default), .protyle-wysiwyg, .protyle-title {font-family: "Number Glyphs Of Custom Font", "Number Glyphs", "Segoe Good Emoji", "Other SiYuan Emojis", "${window.siyuan.config.editor.fontFamily}", var(--b3-font-family-protyle)}`;
     }
     }
     // pad 端菜单移除显示,如工作空间
     // pad 端菜单移除显示,如工作空间
     if ("ontouchend" in document) {
     if ("ontouchend" in document) {