diff --git a/src/assets/fonts/Twemoji.Mozilla.ttf b/src/assets/fonts/Twemoji.Mozilla.ttf new file mode 100644 index 0000000000..9f45178e9d Binary files /dev/null and b/src/assets/fonts/Twemoji.Mozilla.ttf differ diff --git a/src/assets/styles/fonts.scss b/src/assets/styles/fonts.scss new file mode 100644 index 0000000000..1f41b6d580 --- /dev/null +++ b/src/assets/styles/fonts.scss @@ -0,0 +1,16 @@ +// 这个字体是为了解决在 Windows 系统下,微软因为政策问题,不支持显示国旗 emoji 的问题 +@font-face { + font-family: "Color Emoji Flags"; + src: local("Apple Color Emoji"), local("Noto Color Emoji"), + url("../fonts/Twemoji.Mozilla.ttf"); + unicode-range: U+1F1E6-1F1FF; +} + +@font-face { + font-family: "Color Emoji"; + src: local("Apple Color Emoji"), local("Segoe UI Emoji"), + local("Segoe UI Symbol"), local("Noto Color Emoji"), + url("../fonts/Twemoji.Mozilla.ttf"); + + // use local emoji font for better backward compatibility +} diff --git a/src/assets/styles/index.scss b/src/assets/styles/index.scss index 7a99ca38d0..2aff70f599 100644 --- a/src/assets/styles/index.scss +++ b/src/assets/styles/index.scss @@ -1,12 +1,22 @@ @import "./layout.scss"; @import "./page.scss"; +@import "./fonts.scss"; body { margin: 0; overflow: hidden; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", - "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", - sans-serif; + font-family: + system-ui, + -apple-system, + BlinkMacSystemFont, + Segoe UI, + Roboto, + "Helvetica Neue", + Arial, + "Noto Sans", + sans-serif, + "Color Emoji Flags", + "Color Emoji"; user-select: none; -webkit-font-smoothing: antialiased; } diff --git a/src/pages/_theme.tsx b/src/pages/_theme.tsx index f3cf07b334..030fdb22e7 100644 --- a/src/pages/_theme.tsx +++ b/src/pages/_theme.tsx @@ -8,7 +8,7 @@ export const defaultTheme = { error_color: "#d32f2f", warning_color: "#ed6c02", success_color: "#2e7d32", - font_family: `"Roboto", "Helvetica", "Arial", sans-serif`, + font_family: `"Roboto", "Helvetica", "Arial", sans-serif, "Color Emoji Flags"," Color Emoji"`, }; // dark mode