字体统一:建公共字体目录,全部改用开源可商用字体 (#6)
七个模板原先分两套做法:幻灯片/fonts(49MB 鸿蒙 18 个字重)与 科技报告/font(92MB,含 5 款方正商业字体),其余模板直接调系统 SimSun/SimHei/KaiTi/FangSong/Times New Roman。换机器就编不出来, 方正系列也不允许随仓库分发。 统一到仓库根的 fonts/ + fonts.tex: - OUC Serif(思源宋体 SC 子集) —— 宋体 - OUC Sans(思源黑体 SC 子集) —— 黑体 - OUC Kai(霞鹜文楷子集) —— 楷体 - Zhuque Fangsong(朱雀仿宋) —— 仿宋 - TeX Gyre Termes —— 西文 Times 等价(度量逐字相同) - HarmonyOS Sans —— 幻灯片/科技报告原有字体 fonts.tex 是唯一允许声明字体的地方,7 个模板全部 \input 它。 字体体积 141MB -> 49MB(去掉重复),全库共用一套最小集合。 几处踩过的坑(均已写进源码注释): - \newCJKfontfamily 与 ctex 默认 fontset 冲突会中断编译,改用 \setCJKfamilyfont + \def - \newfontfamily 缺粗体档会让 \bfseries 静默失效,四档必须全给 - UprightFont= 与主参数不能同时给,否则文件名被拼两次 - Path= 相对编译时工作目录,不是相对 .sty - ×/□/○ 等符号按 Unicode 区段被判成西文,需 \xeCJKDeclareCharClass - 中文斜体的 ItalicFont 与主字体不在同一目录,须在 ItalicFeatures 里单独写 Path/Extension(否则报 OUCKai-Regular cannot be found) 顺带: - 科技报告 report.tex 的字体演示正文改为新字体名(原文写着方正系列) - 试卷归档封面新模板并入本库 - 科技报告 shell 命令框底色改海大蓝(#5 遗留) 验证(7 个模板 8 个 PDF 全量重编 + 逐行 A/B 对照): - 错误 0,缺字 0 - 幻灯片 362 行逐行完全一致,零漂移 - 年度考核登记表 / 劳务发放说明表 / 试卷题型示例 / 参考答案 文本完全一致 - 课程执行大纲 仅 2 处断字连字符差异(throughout、processing), 1 条 6.39pt Overfull 已论证不可见(距纸张右边缘仍有 20.7mm) - 科技报告 内嵌字体方正归零,只剩 OUC Serif/Sans/Kai + Zhuque - 全库正文 857 个非 ASCII 字符,四款中文字体(含粗体)覆盖 100%
This commit is contained in:
@@ -10,39 +10,57 @@
|
||||
|
||||
%字体
|
||||
|
||||
%设置英文字体 鸿蒙字体
|
||||
\setmainfont[
|
||||
Path=fonts/,
|
||||
BoldFont=HarmonyOS_Sans_Bold.ttf,
|
||||
ItalicFont=HarmonyOS_Sans_Regular_Italic.ttf,
|
||||
BoldItalicFont=HarmonyOS_Sans_Bold_Italic.ttf,
|
||||
]{HarmonyOS_Sans_Regular.ttf}
|
||||
\setsansfont[
|
||||
Path=fonts/,
|
||||
BoldFont=HarmonyOS_Sans_Bold.ttf,
|
||||
ItalicFont=HarmonyOS_Sans_Regular_Italic.ttf,
|
||||
BoldItalicFont=HarmonyOS_Sans_Bold_Italic.ttf,
|
||||
]{HarmonyOS_Sans_Regular.ttf}
|
||||
\setmonofont[
|
||||
Path=fonts/
|
||||
]{HarmonyOS_Sans_Regular.ttf}
|
||||
%======================================================================
|
||||
% 字体全部取自仓库公共字体包 ../../fonts.tex(文件在 ../../fonts/ 下)。
|
||||
%
|
||||
% 旧版这里是 Path=fonts/ 直接读本目录下的 幻灯片/fonts/ —— 那 18 个
|
||||
% 鸿蒙字体文件共 49MB,与其它模板重复,且一旦别处升级就会版本不一致。
|
||||
% 现在统一到仓库根的 fonts/,全库只有一份。
|
||||
%
|
||||
% ⚠️ 路径用 ../fonts/ 而不是 ../../fonts/:
|
||||
% 本文件虽然在 幻灯片/theme/ 下,但被 \usetheme 载入时,
|
||||
% XeTeX 解析 Path= 的相对基准是**编译时的工作目录**(= 幻灯片/),
|
||||
% 不是本文件所在目录。用 ../../ 会跑到仓库外面去找。
|
||||
% 同理 \input{../fonts.tex} 也是相对工作目录的。
|
||||
%======================================================================
|
||||
\input{../fonts.tex}
|
||||
|
||||
% 幻灯片的主字体是鸿蒙:西文用 HarmonyOS Sans,中文用 HarmonyOS Sans SC。
|
||||
% 公共包已把它们登记为 \hmlatin(西文)与 \hm(CJK),这里把三个
|
||||
% fontspec 的"默认族"都指过去 —— beamer 的 \sffamily / \ttfamily
|
||||
% 都要落到鸿蒙上,否则正文会出现一半鸿蒙、一半 Termes 的混排。
|
||||
\setmainfont{HarmonyOS_Sans_Regular.ttf}[
|
||||
Path = ../fonts/harmonyos-sans/,
|
||||
BoldFont = HarmonyOS_Sans_Bold.ttf,
|
||||
ItalicFont = HarmonyOS_Sans_Regular_Italic.ttf,
|
||||
BoldItalicFont = HarmonyOS_Sans_Bold_Italic.ttf,
|
||||
]
|
||||
\setsansfont{HarmonyOS_Sans_Regular.ttf}[
|
||||
Path = ../fonts/harmonyos-sans/,
|
||||
BoldFont = HarmonyOS_Sans_Bold.ttf,
|
||||
ItalicFont = HarmonyOS_Sans_Regular_Italic.ttf,
|
||||
BoldItalicFont = HarmonyOS_Sans_Bold_Italic.ttf,
|
||||
]
|
||||
\setmonofont{HarmonyOS_Sans_Regular.ttf}[
|
||||
Path = ../fonts/harmonyos-sans/,
|
||||
]
|
||||
|
||||
%设置中文字体 鸿蒙字体
|
||||
\setCJKmainfont[
|
||||
Path=fonts/,
|
||||
BoldFont=HarmonyOS_Sans_SC_Bold.ttf,
|
||||
ItalicFont=HarmonyOS_Sans_SC_Regular.ttf,
|
||||
BoldItalicFont=HarmonyOS_Sans_SC_Bold.ttf
|
||||
]{HarmonyOS_Sans_SC_Regular.ttf}
|
||||
\setCJKsansfont[
|
||||
Path=fonts/,
|
||||
BoldFont=HarmonyOS_Sans_SC_Bold.ttf,
|
||||
ItalicFont=HarmonyOS_Sans_SC_Regular.ttf,
|
||||
BoldItalicFont=HarmonyOS_Sans_SC_Bold.ttf
|
||||
]{HarmonyOS_Sans_SC_Regular.ttf}
|
||||
\setCJKmonofont[
|
||||
Path=fonts/
|
||||
]{HarmonyOS_Sans_SC_Regular.ttf}
|
||||
\setCJKmainfont{HarmonyOS_Sans_SC_Regular.ttf}[
|
||||
Path = ../fonts/harmonyos-sans/,
|
||||
BoldFont = HarmonyOS_Sans_SC_Bold.ttf,
|
||||
ItalicFont = HarmonyOS_Sans_SC_Regular.ttf,
|
||||
BoldItalicFont = HarmonyOS_Sans_SC_Bold.ttf,
|
||||
]
|
||||
\setCJKsansfont{HarmonyOS_Sans_SC_Regular.ttf}[
|
||||
Path = ../fonts/harmonyos-sans/,
|
||||
BoldFont = HarmonyOS_Sans_SC_Bold.ttf,
|
||||
ItalicFont = HarmonyOS_Sans_SC_Regular.ttf,
|
||||
BoldItalicFont = HarmonyOS_Sans_SC_Bold.ttf,
|
||||
]
|
||||
\setCJKmonofont{HarmonyOS_Sans_SC_Regular.ttf}[
|
||||
Path = ../fonts/harmonyos-sans/,
|
||||
]
|
||||
|
||||
%以下为原模板代码,未做改动
|
||||
|
||||
|
||||
Reference in New Issue
Block a user