feat: 实现 DOCX 可编辑字体嵌入

This commit is contained in:
SkyJourney
2026-07-31 16:18:30 +08:00
parent f3847f3e4b
commit 10bc62cee4
32 changed files with 2195 additions and 76 deletions
+11 -51
View File
@@ -1,43 +1,3 @@
@font-face {
font-family: "Mdpdf Fandol Song";
font-style: normal;
font-weight: 400;
font-display: block;
src: url("theme-shared:official-fonts/FandolSong-Regular.woff2") format("woff2");
}
@font-face {
font-family: "Mdpdf Fandol Song";
font-style: normal;
font-weight: 700;
font-display: block;
src: url("theme-shared:official-fonts/FandolSong-Bold.woff2") format("woff2");
}
@font-face {
font-family: "Mdpdf Fandol Fang";
font-style: normal;
font-weight: 400;
font-display: block;
src: url("theme-shared:official-fonts/FandolFang-Regular.woff2") format("woff2");
}
@font-face {
font-family: "Mdpdf Fandol Hei";
font-style: normal;
font-weight: 400;
font-display: block;
src: url("theme-shared:official-fonts/FandolHei-Regular.woff2") format("woff2");
}
@font-face {
font-family: "Mdpdf Fandol Kai";
font-style: normal;
font-weight: 400;
font-display: block;
src: url("theme-shared:official-fonts/FandolKai-Regular.woff2") format("woff2");
}
:root {
--official-red: #d40000;
--official-ink: #111;
@@ -48,7 +8,7 @@
#write {
color: var(--official-ink);
font-family:
"Mdpdf Fandol Fang", "FangSong", "STFangsong", "Noto Serif CJK SC",
"FandolFang", "FangSong", "STFangsong", "Noto Serif CJK SC",
"Source Han Serif SC", "SimSun", serif;
font-size: 21.333px;
line-height: 1.75;
@@ -72,7 +32,7 @@
justify-content: space-between;
color: var(--official-ink);
font-family:
"Mdpdf Fandol Hei", "SimHei", "Noto Sans CJK SC",
"FandolHei", "SimHei", "Noto Sans CJK SC",
"Microsoft YaHei", sans-serif;
font-size: 0.75em;
font-weight: 400;
@@ -82,7 +42,7 @@
margin: 9mm 0 8mm;
color: var(--official-red);
font-family:
"Mdpdf Fandol Song", "STZhongsong", "Noto Serif CJK SC",
"FandolSong", "STZhongsong", "Noto Serif CJK SC",
"Source Han Serif SC", serif;
font-size: 2em;
font-weight: 700;
@@ -104,13 +64,13 @@
#write .doc-signatory > span {
font-family:
"Mdpdf Fandol Fang", "FangSong", "STFangsong",
"FandolFang", "FangSong", "STFangsong",
"Noto Serif CJK SC", serif;
}
#write .doc-signatory {
font-family:
"Mdpdf Fandol Kai", "KaiTi", "STKaiti",
"FandolKai", "KaiTi", "STKaiti",
"Noto Serif CJK SC", serif;
}
@@ -118,7 +78,7 @@
margin: 0 0 12mm;
color: var(--official-ink);
font-family:
"Mdpdf Fandol Song", "STZhongsong", "Noto Serif CJK SC",
"FandolSong", "STZhongsong", "Noto Serif CJK SC",
"Source Han Serif SC", serif;
font-size: 1.375em;
font-weight: 700;
@@ -136,7 +96,7 @@
margin: 1em 0 0.35em;
color: var(--official-ink);
font-family:
"Mdpdf Fandol Hei", "SimHei", "Noto Sans CJK SC",
"FandolHei", "SimHei", "Noto Sans CJK SC",
"Microsoft YaHei", sans-serif;
font-size: 1em;
font-weight: 400;
@@ -150,7 +110,7 @@
#write h5,
#write h6 {
font-family:
"Mdpdf Fandol Kai", "KaiTi", "STKaiti",
"FandolKai", "KaiTi", "STKaiti",
"Noto Serif CJK SC", serif;
font-weight: 400;
}
@@ -200,7 +160,7 @@
margin: 0.8em 0;
border-collapse: collapse;
font-family:
"Mdpdf Fandol Song", "SimSun", "Noto Serif CJK SC",
"FandolSong", "SimSun", "Noto Serif CJK SC",
"Source Han Serif SC", serif;
font-size: 0.75em;
line-height: 1.5;
@@ -215,7 +175,7 @@
#write th {
background: #f5f5f5;
font-family:
"Mdpdf Fandol Hei", "SimHei", "Noto Sans CJK SC",
"FandolHei", "SimHei", "Noto Sans CJK SC",
"Microsoft YaHei", sans-serif;
font-weight: 400;
text-align: center;
@@ -262,7 +222,7 @@
border-bottom: 0.35mm solid var(--official-rule);
break-inside: avoid;
font-family:
"Mdpdf Fandol Fang", "FangSong", "STFangsong",
"FandolFang", "FangSong", "STFangsong",
"Noto Serif CJK SC", serif;
font-size: 0.875em;
line-height: 1.7;
+38 -2
View File
@@ -33,7 +33,7 @@
"height": "8mm",
"showDivider": false,
"fontSize": "4.94mm",
"fontFamily": "\"Mdpdf Fandol Song\", SimSun, serif",
"fontFamily": "\"FandolSong\", SimSun, serif",
"color": "#000000",
"left": {
"enabled": false,
@@ -53,7 +53,7 @@
"height": "7mm",
"showDivider": false,
"fontSize": "4.94mm",
"fontFamily": "\"Mdpdf Fandol Song\", SimSun, serif",
"fontFamily": "\"FandolSong\", SimSun, serif",
"color": "#000000",
"alignment": "outer",
"format": "official-page",
@@ -61,6 +61,42 @@
"showOnFirstPage": true
}
},
"docxFonts": {
"faces": [
{
"family": "FandolSong",
"aliases": ["Mdpdf Fandol Song", "STZhongsong", "SimSun"],
"source": "theme-shared:official-fonts/FandolSong-Regular.woff2",
"weight": 400,
"license": "GPL-3.0-or-later WITH Font-exception-2.0"
},
{
"family": "FandolSong",
"aliases": ["Mdpdf Fandol Song", "STZhongsong", "SimSun"],
"source": "theme-shared:official-fonts/FandolSong-Bold.woff2",
"weight": 700,
"license": "GPL-3.0-or-later WITH Font-exception-2.0"
},
{
"family": "FandolFang",
"aliases": ["Mdpdf Fandol Fang", "FangSong", "STFangsong"],
"source": "theme-shared:official-fonts/FandolFang-Regular.woff2",
"license": "GPL-3.0-or-later WITH Font-exception-2.0"
},
{
"family": "FandolHei",
"aliases": ["Mdpdf Fandol Hei", "SimHei", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei"],
"source": "theme-shared:official-fonts/FandolHei-Regular.woff2",
"license": "GPL-3.0-or-later WITH Font-exception-2.0"
},
{
"family": "FandolKai",
"aliases": ["Mdpdf Fandol Kai", "KaiTi", "STKaiti"],
"source": "theme-shared:official-fonts/FandolKai-Regular.woff2",
"license": "GPL-3.0-or-later WITH Font-exception-2.0"
}
]
},
"docxStyle": {
"preset": "official"
},