跳转至内容

微软字体

来自 ArchWiki

本文或本节需要在语言、wiki 语法或风格方面进行改进。请参阅 Help:Style 获取参考。

原因: 可以转换为使用 Template:App。(在 Talk:Microsoft fonts 中讨论)

本文介绍了如何安装 TrueType Microsoft 字体并模拟 Windows 的字体渲染。

提示 请参阅 度量兼容字体 以了解替代方案。

安装

自动安装

注意 这些软件包在构建时会自动获取 Windows 企业版 90 天评估版 ISO,并从中提取所需的字体。

安装字体最简单的方法是安装以下软件包之一:

当前软件包

注意 这些软件包需要事先从 Windows 分区 或通过 从 Windows 和/或 Office 2007 ISO 提取 手动获取字体。详情请参阅相应的 PKGBUILDs

使用 Windows 分区的字体

如果挂载了 Windows 分区,可以直接使用其中的字体。有几种实现方法(假设 Windows C:\ 盘挂载在 /windows

  • 使用符号链接 (symlink)
# ln -s /windows/Windows/Fonts /usr/local/share/fonts/WindowsFonts
注意 google-chromeAUR 的用户应避免使用此方法,因为符号链接字体可能会导致 Chrome 崩溃。
  • 将文件复制到 /usr/local/share/fonts/
# mkdir -p /usr/local/share/fonts/WindowsFonts
# cp -r /windows/Windows/Fonts/* /usr/local/share/fonts/WindowsFonts/
# chmod -R 644 /usr/local/share/fonts/WindowsFonts/*
  • 使用绑定挂载 (bind mount)
# mount --bind /windows/Windows/Fonts /usr/local/share/fonts/WindowsFonts

若要永久生效,请按如下方式编辑 fstab 文件

/etc/fstab
/windows/Windows/Fonts    /usr/local/share/fonts/WindowsFonts    none    bind    0    0

更多详情请参阅 mount(8) § Bind mount operation

请记住,为了能够读取字体文件,可能需要针对 系统压缩文件 应用解决方法。

选择其中一种方案后,重新生成 fontconfig 缓存

# fc-cache --force
# fc-cache-32 --force

从 Windows ISO 提取字体

字体也可以在 Windows ISO 文件中找到。ISO 中包含字体的镜像文件格式:如果是从网上下载的 ISO 则是 WIM (Windows Imaging Format);如果是使用 Windows 的 Media Creation Tool 构建的则是 ESD (Windows Electronic Software Download)。从 .iso 中提取 sources/install.esdsources/install.wim 文件,并在该文件中寻找 Windows/Fonts 目录。可以使用 7zwimextract (包含在 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 目录中。

旧版软件包

注意 这些软件包提供的字体已经过时,缺失现代的微调 (hinting) 指令以及完整的字符集,但优点是不需要用户提供字体文件。建议改为使用 #当前软件包 中的内容。

ttf-ms-fontsAUR 包含:

警告 根据 微软原始的最终用户许可协议,使用上述字体存在某些法律限制。

你还可以安装 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 阅读器中符号显示不正常

Microsoft 的 Symbol 字体 (Wikipedia:Symbol (typeface)) 在 Poppler 中存在 Bug,数学符号在基于 Poppler 的 PDF 阅读器中可能无法正确显示。

© . This site is unofficial and not affiliated with Arch Linux.

Content is available under GNU Free Documentation License 1.3 or later unless otherwise noted.