Microsoft 字体
本文介绍如何安装 TrueType Microsoft 字体并模拟 Windows 的字体渲染。
安装
自动安装
安装字体最简单的方法是安装以下软件包之一
- ttf-ms-win10-autoAUR — Windows 10 字体
- ttf-ms-win11-autoAUR — Windows 11 字体
使用 Windows 分区中的字体
如果已挂载 Windows 分区,则可以通过链接到其中的字体来使用它们。 可能需要应用 系统压缩文件 的解决方法才能读取字体文件。
例如,如果 Windows C:\
分区挂载在 /windows
# ln -s /windows/Windows/Fonts /usr/local/share/fonts/WindowsFonts
然后重新生成 fontconfig 缓存
# fc-cache --force
或者,将 Windows 字体复制到 /usr/local/share/fonts/
# mkdir /usr/local/share/fonts # mkdir /usr/local/share/fonts/WindowsFonts # cp /windows/Windows/Fonts/* /usr/local/share/fonts/WindowsFonts/ # chmod 644 /usr/local/share/fonts/WindowsFonts/*
然后重新生成 fontconfig 缓存
# fc-cache --force # fc-cache-32 --force
从 Windows ISO 镜像中提取字体
字体也可以在 Windows ISO 文件中找到。 如果 ISO 是在线下载的,则包含 ISO 中字体的镜像文件格式为 WIM (Windows Imaging Format);如果 ISO 是使用 Windows 的媒体创建工具构建的,则为 ESD (Windows Electronic Software Download)。 从 .iso 中提取 sources/install.esd
或 sources/install.wim
文件,并在该文件中查找 Windows/Fonts
目录。 可以使用 7z (在 p7zip 中)或 wimextract (在 wimlib 中)提取。 请参见以下使用 7z 的示例
$ 7z e WinXY_YYMM_English_x64.iso sources/install.wim $ 7z e install.wim 1/Windows/{Fonts/"*".{ttf,ttc},System32/Licenses/neutral/"*"/"*"/license.rtf} -ofonts/
字体和许可证将位于 fonts
目录中。
当前软件包
- ttf-office-2007-fontsAUR — Office 2007 字体
- ttf-win7-fontsAUR — Windows 7 字体
- ttf-ms-win8AUR — Windows 8.1 字体
- ttf-ms-win10AUR — Windows 10 字体
- ttf-ms-win11AUR — Windows 11 字体
旧软件包
ttf-ms-fontsAUR 包括
- Andalé Mono
- Arial
- Arial Black
- Comic Sans
- Courier New
- Georgia
- Impact
- Lucida Sans
- Lucida Console
- Microsoft Sans Serif
- Times New Roman
- Trebuchet
- Verdana
- Webdings
您还可以获取 ttf-tahomaAUR,顾名思义,其中包含 Tahoma。
ttf-vista-fontsAUR 包括
对 MS 字体有用的 Fontconfig 规则
类似字体的规则映射
通常,网站使用通用名称(helvetica、courier、times 或 times new roman)指定字体,而 fontconfig 中的规则将这些名称映射到免费字体(Liberation、Google CrOS、GUST TeX Gyre...)。 替换在 /etc/fonts/conf.d/30-metric-aliases.conf
中定义。
为了充分利用 Ms Windows 字体,有必要创建一个规则,将这些通用名称映射到上面各种软件包中包含的 Ms Windows 特定字体
<?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <alias binding="same"> <family>Helvetica</family> <accept> <family>Arial</family> </accept> </alias> <alias binding="same"> <family>Times</family> <accept> <family>Times New Roman</family> </accept> </alias> <alias binding="same"> <family>Courier</family> <accept> <family>Courier New</family> </accept> </alias> </fontconfig>
将您喜欢的浏览器中的 serif、sans-serif、monospace 字体与 MS 字体关联也很有用。
禁用内嵌位图字体
某些 Microsoft TTF 字体(如 Calibri 和 Cambria)包含特定字体大小的内嵌位图字体,这些字体未抗锯齿。 如果启用内嵌位图,则在这些特定大小下,字体不会进行抗锯齿处理。 内嵌位图字体可以在字体配置中禁用。
已知问题
使用基于 Poppler 的 PDF 阅读器时符号显示不正确
用于符号的 TrueType Microsoft 字体 (Wikipedia:Symbol (typeface)) 在 Poppler 中存在错误,数学符号可能在基于 Poppler 的 PDF 阅读器中显示不正确。