字体统一:建公共字体目录,全部改用开源可商用字体 (#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:
+5
-3
@@ -16,7 +16,7 @@
|
||||
|
||||
1. slides.tex:主文件,编写的演示文稿内容主要存放在该文件当中。
|
||||
2. oucslide.sty:模板的样式文件。
|
||||
3. fonts:字体文件夹,所有编译需要用到的字体。默认字体使用的是华为鸿蒙字体。
|
||||
3. (字体不在本目录) 全部字体已统一到仓库根 `../fonts/`,由 `../fonts.tex` 统一加载。默认字体仍是华为鸿蒙字体。
|
||||
4. theme:主题文件夹。
|
||||
1. beamercolorthemeOUCSlide.sty:颜色定义文件。
|
||||
2. beamerfontthemeOUCSlide.sty:字体定义文件。
|
||||
@@ -33,7 +33,7 @@
|
||||
git clone https://code.yangyq.net/laoyang/ouc_latex_template.git
|
||||
cd ouc_latex_template/幻灯片
|
||||
```
|
||||
子目录内自包含(`theme/`、`fonts/`、`logos/`、`figs/` 都在本目录),不需要额外的宏包搜索路径。
|
||||
子目录内自包含(`theme/`、`logos/`、`figs/` 都在本目录),只有字体是共享的上层目录 `../fonts/`,不需要额外的宏包搜索路径。
|
||||
2. 安装Tex编译器,推荐使用<a href="https://tug.org/texlive/" target="_blank">TexLive</a>,安装成功后,可以使用自带的TeXworks打开目录下的tex文件进行编译。
|
||||
3. 可以安装其他的IDE工具进行Tex文件的编写和修改,推荐使用<a href="https://code.visualstudio.com/" target="_blank">Visual Studio Code</a>。
|
||||
4. 编译时,请选择XeLaTex,有时候,可能需要连续编译两次,以得到正确的页码和图表编号。
|
||||
@@ -199,7 +199,9 @@ Tex文件的开头,是基本信息部分,可以根据需要添加`\title`{
|
||||
## 字体
|
||||
模板使用的默认字体是<a href="https://developer.harmonyos.com/cn/docs/design/font-0000001157868583" target="_blank">华为鸿蒙字体 (HarmonyOS Sans)</a>。该字体可以免费商用。
|
||||
|
||||
如果对字体不满意,可下载其他字体,放入fonts文件夹,并在`beamerfontthemeOUCSlide.sty`文件中修改。
|
||||
如果对字体不满意,可把字体放进仓库根的 `fonts/` 目录,并在 `theme/beamerfontthemeOUCSlide.sty` 中修改。**注意**:`Path=` 是相对编译时工作目录(= `幻灯片/`)的,所以写 `../fonts/xxx/`,不是 `fonts/`。
|
||||
|
||||
只保留实际用到的 6 个鸿蒙文件(Regular/Bold 及其 Italic,加 SC Regular/Bold)——原先 `幻灯片/fonts/` 里的 Black / Light / Medium / Thin 等 12 个字重全库无人引用,已随目录一并删除,省下 49 MB。
|
||||
|
||||
推荐的字体包括:<a href="https://github.com/adobe-fonts/source-han-sans" target="_blank">思源黑体</a>、<a href="https://alibabafont.taobao.com/wow/alibabafont/act/alifont" target="_blank">阿里普惠字体</a>、<a href="https://www.thosefree.com/oppo-sans" target="_blank">OPPO字体</a>、<a href="https://web.vip.miui.com/page/info/mio/mio/detail?postId=33935854" target="_blank">小米字体</a>。这些字体基本上都可以免费商用,并且效果都很不错。关于他们是否能够继续免费商用的政策,请查阅其官方网站以得到最准确的信息。
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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