Skip to content

Commit

Permalink
🎨 #13241
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Dec 17, 2024
1 parent e1829a8 commit 95f24e3
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 43 deletions.
7 changes: 0 additions & 7 deletions app/appearance/emojis/conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -6939,13 +6939,6 @@
"description_zh_cn": "神社",
"keywords": "religion,shinto,shrine,宗教,建物,建築物,神社,神道,日本,神道教"
},
{
"unicode": "e50a",
"description": "Shibuya",
"description_ja_jp": "渋谷",
"description_zh_cn": "涩谷",
"keywords": "109,shibuya,建物,建築物,渋谷区,日本,涩谷区"
},
{
"unicode": "1f54b",
"description": "Kaaba",
Expand Down
12 changes: 6 additions & 6 deletions app/appearance/themes/daylight/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
--b3-theme-on-error: #fff;

/* 字体 */
--b3-font-family: "Emojis Reset", BlinkMacSystemFont, Helvetica, "Luxi Sans", "DejaVu Sans", "Hiragino Sans", arial, sans-serif, emojis;
--b3-font-family: "Apple Additional Emojis", "Emojis Reset", BlinkMacSystemFont, Helvetica, "Luxi Sans", "DejaVu Sans", "Hiragino Sans", arial, sans-serif, emojis;
--b3-font-family-protyle: var(--b3-font-family);
--b3-font-family-code: "Emojis Reset", "JetBrainsMono-Regular", mononoki, Consolas, "Liberation Mono", Menlo, Courier, monospace, var(--b3-font-family);
--b3-font-family-code: "Apple Additional Emojis", "Emojis Reset", "JetBrainsMono-Regular", mononoki, Consolas, "Liberation Mono", Menlo, Courier, monospace, var(--b3-font-family);
--b3-font-family-graph: arial;
--b3-font-family-emoji: emojis;
--b3-font-family-emoji: "Apple Additional Emojis", emojis;
--b3-font-family-math: KaTeX_Math;
--b3-font-size: 14px;

Expand Down Expand Up @@ -202,15 +202,15 @@

/* 微软字体斜体会被相邻背景遮挡,将 arial 放置其前 https://github.com/siyuan-note/siyuan/issues/11841;"Segoe UI" 和 Noto-COLRv1-2.047 冲突,故移除。 */
:root:lang(zh_CN) {
--b3-font-family: "Emojis Reset", BlinkMacSystemFont, Helvetica, "PingFang SC", "Luxi Sans", "DejaVu Sans", "Hiragino Sans GB", "Source Han Sans SC", arial, "Microsoft Yahei", sans-serif, emojis;
--b3-font-family: "Apple Additional Emojis", "Emojis Reset", BlinkMacSystemFont, Helvetica, "PingFang SC", "Luxi Sans", "DejaVu Sans", "Hiragino Sans GB", "Source Han Sans SC", arial, "Microsoft Yahei", sans-serif, emojis;
}

:root:lang(zh_CHT) {
--b3-font-family: "Emojis Reset", BlinkMacSystemFont, Helvetica, "PingFang TC", "Luxi Sans", "DejaVu Sans", "Hiragino Sans TC", "Source Han Sans TC", "Microsoft JhengHei", arial, sans-serif, emojis;
--b3-font-family: "Apple Additional Emojis", "Emojis Reset", BlinkMacSystemFont, Helvetica, "PingFang TC", "Luxi Sans", "DejaVu Sans", "Hiragino Sans TC", "Source Han Sans TC", "Microsoft JhengHei", arial, sans-serif, emojis;
}

:root:lang(ja_JP) {
--b3-font-family: "Emojis Reset", BlinkMacSystemFont, Helvetica, "Luxi Sans", "DejaVu Sans", "Hiragino Sans", "Yu Gothic UI", arial, sans-serif, emojis;
--b3-font-family: "Apple Additional Emojis", "Emojis Reset", BlinkMacSystemFont, Helvetica, "Luxi Sans", "DejaVu Sans", "Hiragino Sans", "Yu Gothic UI", arial, sans-serif, emojis;
}

/* https://github.com/siyuan-note/siyuan/issues/6440 */
Expand Down
12 changes: 6 additions & 6 deletions app/appearance/themes/midnight/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
--b3-theme-on-error: #fff;

/* 字体 */
--b3-font-family: "Emojis Reset", BlinkMacSystemFont, Helvetica, "Luxi Sans", "DejaVu Sans", "Hiragino Sans", arial, sans-serif, emojis;
--b3-font-family: "Apple Additional Emojis", "Emojis Reset", BlinkMacSystemFont, Helvetica, "Luxi Sans", "DejaVu Sans", "Hiragino Sans", arial, sans-serif, emojis;
--b3-font-family-protyle: var(--b3-font-family);
--b3-font-family-code: "Emojis Reset", "JetBrainsMono-Regular", mononoki, Consolas, "Liberation Mono", Menlo, Courier, monospace, var(--b3-font-family);
--b3-font-family-code: "Apple Additional Emojis", "Emojis Reset", "JetBrainsMono-Regular", mononoki, Consolas, "Liberation Mono", Menlo, Courier, monospace, var(--b3-font-family);
--b3-font-family-graph: arial;
--b3-font-family-emoji: emojis;
--b3-font-family-emoji: "Apple Additional Emojis", emojis;
--b3-font-family-math: KaTeX_Math;
--b3-font-size: 14px;

Expand Down Expand Up @@ -202,15 +202,15 @@

/* 微软字体斜体会被相邻背景遮挡,将 arial 放置其前 https://github.com/siyuan-note/siyuan/issues/11841;"Segoe UI" 和 Noto-COLRv1-2.047 冲突,故移除。 */
:root:lang(zh_CN) {
--b3-font-family: "Emojis Reset", BlinkMacSystemFont, Helvetica, "PingFang SC", "Luxi Sans", "DejaVu Sans", "Hiragino Sans GB", "Source Han Sans SC", arial, "Microsoft Yahei", sans-serif, emojis;
--b3-font-family: "Apple Additional Emojis", "Emojis Reset", BlinkMacSystemFont, Helvetica, "PingFang SC", "Luxi Sans", "DejaVu Sans", "Hiragino Sans GB", "Source Han Sans SC", arial, "Microsoft Yahei", sans-serif, emojis;
}

:root:lang(zh_CHT) {
--b3-font-family: "Emojis Reset", BlinkMacSystemFont, Helvetica, "PingFang TC", "Luxi Sans", "DejaVu Sans", "Hiragino Sans TC", "Source Han Sans TC", "Microsoft JhengHei", arial, sans-serif, emojis;
--b3-font-family: "Apple Additional Emojis", "Emojis Reset", BlinkMacSystemFont, Helvetica, "PingFang TC", "Luxi Sans", "DejaVu Sans", "Hiragino Sans TC", "Source Han Sans TC", "Microsoft JhengHei", arial, sans-serif, emojis;
}

:root:lang(ja_JP) {
--b3-font-family: "Emojis Reset", BlinkMacSystemFont, Helvetica, "Luxi Sans", "DejaVu Sans", "Hiragino Sans", "Yu Gothic UI", arial, sans-serif, emojis;
--b3-font-family: "Apple Additional Emojis", "Emojis Reset", BlinkMacSystemFont, Helvetica, "Luxi Sans", "DejaVu Sans", "Hiragino Sans", "Yu Gothic UI", arial, sans-serif, emojis;
}

/* https://github.com/siyuan-note/siyuan/issues/6440 */
Expand Down
21 changes: 0 additions & 21 deletions app/src/assets/scss/component/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,6 @@
src: url(../fonts/JetBrainsMono-2.304/JetBrainsMono-Regular.woff2) format('woff2');
}

@font-face {
font-family: "Emojis";
src: url(../fonts/Noto-COLRv1-2.047/Noto-COLRv1.woff2) format("woff2"),
local("Segoe UI Emoji"),
local("Segoe UI Symbol"),
local("Apple Color Emoji"),
local("Twemoji Mozilla"),
local("Noto Color Emoji"),
local("Android Emoji"),
local("EmojiSymbols");
}

@font-face {
font-family: "Emojis Reset";
src: url(../fonts/Noto-COLRv1-2.047/Noto-COLRv1.woff2) format("woff2");
unicode-range: U+263a, U+2194-2199, U+2934-2935, U+2639, U+26a0, U+25b6, U+25c0, U+23cf, U+2640, U+2642, U+203c, U+2049,
U+2611, U+303d, U+00a9, U+00ae, U+2122, U+1f170-1f171, U+24c2, U+1f17e, U+1f17f, U+1f22f, U+1f250, U+1f21a,
U+1f232-1f23a, U+1f251, U+3297, U+3299, U+25aa, U+25ab, U+2660, U+2666, U+2665, U+2663, U+1f636, U+1f62e, U+1f642,
U+1f635, U+2620, U+2763, U+2764, U+1f441, U+270c, U+261d, U+270d, U+200d, U+e50a;
}

.b3-typography,
.protyle-wysiwyg {
font-variant-ligatures: no-common-ligatures;
Expand Down
51 changes: 48 additions & 3 deletions app/src/util/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {exportLayout} from "../layout/util";
/// #endif
import {fetchPost} from "./fetch";
import {appearance} from "../config/appearance";
import {isInAndroid, isInHarmony, isInIOS} from "../protyle/util/compatibility";
import {isInAndroid, isInHarmony, isInIOS, isIPad, isIPhone, isMac} from "../protyle/util/compatibility";

const loadThirdIcon = (iconURL: string, data: Config.IAppearance) => {
addScript(iconURL, "iconDefaultScript").then(() => {
Expand Down Expand Up @@ -201,7 +201,52 @@ export const addGA = () => {

export const setInlineStyle = (set = true) => {
const height = Math.floor(window.siyuan.config.editor.fontSize * 1.625);
let style = `.b3-typography, .protyle-wysiwyg, .protyle-title {font-size:${window.siyuan.config.editor.fontSize}px !important}
let style;
// Emojis Reset: 字体中包含了 emoji,需重置
// Apple Additional Emojis: 苹果字体中没有的 emoji
if (isMac() || isIPad() || isIPhone()) {
style = `@font-face {
font-family: "Apple Additional Emojis";
src: url(stage/build/fonts/Noto-COLRv1.woff2) format("woff2");
unicode-range: U+1fae9, U+1fac6, U+1fabe, U+1fadc, U+e50a, U+1fa89, U+1fadf, U+1f1e6-1f1ff, U+1fa8f;
}
@font-face {
font-family: "Emojis Reset";
src: local("Apple Color Emoji"),
local("Segoe UI Emoji"),
local("Segoe UI Symbol");
unicode-range: U+263a, U+1fae4, U+2194-2199, U+2934-2935, U+25b6, U+25c0, U+23cf, U+2640, U+2642, U+2611, U+303d,
U+3030, U+00a9, U+00ae, U+2122, U+1f170, U+1f171, U+24c2, U+1f17e, U+1f17f, U+1f250, U+1f21a, U+1f22f, U+1f232-1f23a,
U+1f251, U+3297, U+3299, U+2639;
}
@font-face {
font-family: "Emojis";
src: local("Apple Color Emoji"),
local("Segoe UI Emoji"),
local("Segoe UI Symbol");
}`
} else {
style = `@font-face {
font-family: "Emojis";
src: url(stage/build/fonts/Noto-COLRv1.woff2) format("woff2"),
local("Segoe UI Emoji"),
local("Segoe UI Symbol"),
local("Apple Color Emoji"),
local("Twemoji Mozilla"),
local("Noto Color Emoji"),
local("Android Emoji"),
local("EmojiSymbols");
}
@font-face {
font-family: "Emojis Reset";
src: url(stage/build/fonts/Noto-COLRv1.woff2) format("woff2");
unicode-range: U+263a, U+2194-2199, U+2934-2935, U+2639, U+26a0, U+25b6, U+25c0, U+23cf, U+2640, U+2642, U+203c, U+2049,
U+2611, U+303d, U+00a9, U+00ae, U+2122, U+1f170-1f171, U+24c2, U+1f17e, U+1f17f, U+1f22f, U+1f250, U+1f21a,
U+1f232-1f23a, U+1f251, U+3297, U+3299, U+25aa, U+25ab, U+2660, U+2666, U+2665, U+2663, U+1f636, U+1f62e, U+1f642,
U+1f635, U+2620, U+2763, U+2764, U+1f441, U+270c, U+261d, U+270d, U+200d, U+e50a, U+3030;
}`;
}
style += `.b3-typography, .protyle-wysiwyg, .protyle-title {font-size:${window.siyuan.config.editor.fontSize}px !important}
.b3-typography code:not(.hljs), .protyle-wysiwyg span[data-type~=code] { font-variant-ligatures: ${window.siyuan.config.editor.codeLigatures ? "normal" : "none"} }
.li > .protyle-action {height:${height + 8}px;line-height: ${height + 8}px}
.protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h1, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h2, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h3, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h4, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h5, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h6 {line-height:${height + 8}px;}
Expand All @@ -219,7 +264,7 @@ export const setInlineStyle = (set = true) => {
.protyle-wysiwyg .li {min-height:${height + 8}px}
.protyle-gutters button svg {height:${height}px}`;
if (window.siyuan.config.editor.fontFamily) {
style += `\n.b3-typography:not(.b3-typography--default), .protyle-wysiwyg, .protyle-title {font-family: "Emojis Reset", "${window.siyuan.config.editor.fontFamily}", var(--b3-font-family)}`;
style += `\n.b3-typography:not(.b3-typography--default), .protyle-wysiwyg, .protyle-title {font-family: "Apple Additional Emojis", "Emojis Reset", "${window.siyuan.config.editor.fontFamily}", var(--b3-font-family)}`;
}
// pad 端菜单移除显示,如工作空间
if ("ontouchend" in document) {
Expand Down

0 comments on commit 95f24e3

Please sign in to comment.