跳转至内容

度量兼容字体

来自 ArchWiki

本文或本章节的准确性存在争议。

原因:视觉相似并不等于度量兼容。例如,FreeSerif 在视觉上与 Times New Roman 相似,但在度量上不同。TeX Gyre Termes 也是如此,尽管差异非常微小。(在 Talk:Metric-compatible fonts 中讨论)

度量兼容字体是指与另一种字体(通常是通用字体,如 Helvetica、Times 或 Courier)的度量(即字形尺寸)相匹配的字体。由于其度量匹配,用度量兼容的替代品替换字体,不会改变文档或网页的格式。此类字体通常是为 FOSS(自由及开源软件)系统开发的,以便正确显示页面。

度量兼容字体列表

在下表中,常用的字体族以粗体显示。该表大致基于 fontconfig30-metric-aliases.conf 以及维基百科中关于各字体的页面。

“Web 核心字体”兼容性
PostScript URW GUST GNU Microsoft Liberation CrOS StarOffice
Helvetica Nimbus Sans, A030 TeX Gyre Heros FreeSans Arial Liberation Sans Arimo Albany
Times Nimbus Roman TeX Gyre Termes FreeSerif Times New Roman Liberation Serif Tinos Thorndale
Courier Nimbus Mono TeX Gyre Cursor FreeMono Courier New Liberation Mono Cousine Cumberland
Helvetica Condensed Nimbus Sans Narrow TeX Gyre Heros Cn Arial Narrow Liberation Sans Narrow
Georgia Gelasio
Wingdings (PS3) URWDings, New Dingbats Wingdings
Microsoft Office 字体
Microsoft CrOS
Cambria Caladea
Calibri Carlito
符号 SymbolNeu
Microsoft UI 字体
Microsoft FOSS
Segoe UI Selawik
Tahoma Wine Tahoma
上 1884÷2048em,下 514÷2048em,宽 1126÷2048em 的字体
Microsoft 字体设计
Consolas DMCA Sans Serif
具有 8×16 和 16×16 字形的字体
GNU 字体设计
Unifont Kissinger 2
其他 PostScript 核心字体族
PostScript URW GUST Windows
ITC Avant Garde Gothic URW Gothic TeX Gyre Adventor Century Gothic
ITC Bookman Bookman URW TeX Gyre Bonum Bookman Old Style
ITC Zapf Chancery Chancery URW, Z003 TeX Gyre Chorus Monotype Corsiva
Palatino Palladio URW, P052 TeX Gyre Pagella Palatino Linotype, Book Antiqua
New Century Schoolbook Century SchoolBook URW, C059 TeX Gyre Schola Century Schoolbook
ITC Zapf Dingbats Dingbats, D050000L
PostScript 3 字体
PostScript URW
Optima URW Classico
Antique Olive Antique Olive
Univers URW Classic Sans, U001
Clarendon Bold Condensed Clarendon URW Bold Condensed, C011 Bold Condensed
Coronet Coronet
Letter Gothic Letter Gothic
Marigold Mauritius
Albertus Algiers, A028
Garamond Garamond No. 8

通用字体族

PostScript

PostScript 语言在 PostScript 2 中定义了 35 种核心字体。URW 为 Ghostscript 发布了这些字体的开源版本/克隆,可通过 gsfonts 获取。包括 GUST 的 TeX GyreGNU FreeFont 在内的项目发布了这些字体的增强版本。

PostScript 3 定义了额外的 101 种字体,其中许多由 URW 根据 AFPLGhostPDL[失效链接 2025-01-22—HTTP 404] 中提供。AFPL 禁止商业用途。许多双重字体名称是由于一次批量更新[失效链接 2025-01-22—HTTP 404]造成的。

Garamond

URW 的 Garamond No.8 仅提供一种光学尺寸 (8pt)。您可以使用 EB Garamond 来获得更多 OpenType 特性,包括 12pt 尺寸。然而,它不保证与度量完全相同。

Microsoft

Microsoft 在 Windows 和 Microsoft Office 中捆绑了许多字体。虽然其中一些字体只是相应 PostScript 字体族的廉价版本(或外观相似版本),但 Cambria 和 Calibri(自 MS Office 2007 以来的默认字体)与其他字体族是独立的。Microsoft 曾经在其 Web 核心字体项目中提供了许多核心字体。虽然该项目后来在 Microsoft 网站上不可用,但允许从第三方网站分发这些字体的许可条款使得像 ttf-ms-fontsAUR 这样的包成为可能。另请参阅 Microsoft 字体

在引入 Arial 和 Times New Roman 之前,Microsoft 在 Windows 1.0 中使用了两种名为 Helv 和 Tms Rmn 的位图字体,它们都是此处涵盖的更著名字体的未经许可的模仿版本。它们在 Windows 3.1 开始被重命名为 MS Sans SerifMS Serif,而 MS Sans Serif 最终被矢量化为“Microsoft Sans Serif”。使用这些字体的文档很少见,但在 Mono libgdiplus 应用程序中偶尔可以找到使用 Microsoft Sans Serif 的用户界面。在尝试替换这些字体时,通常可以安全地认为它们与 Helvetica 和 Times 是度量兼容的。

度量兼容字体项目

TeX Gyre

TeX Gyre (tex-gyre-fonts) 是随 Ghostscript 4.00 分发的 35 种基础 PostScript 字体的重制和扩展版本。该项目提供 TeX 支持以及字体的跨平台 OpenType 格式。相关项目 TeX Gyre Math 提供相应的 OpenType 数学字体。

GNU FreeFont

GNU FreeFont (gnu-free-fonts) 是一个轮廓字体族,旨在尽可能多地覆盖 通用字符集。大多数拉丁字符来自 URW (Nimbus) 字体。这套字体以 GPL v3+ + FE 许可发布。请注意,对于非 LGC(拉丁、希腊、西里尔)语言,部分字形的质量可能被认为较低。

Liberation

Liberation 字体提供了四个字体族:Liberation Sans、Liberation Serif 和 Liberation Mono,旨在与常见的 Microsoft Windows 字体度量兼容。自 2.0.0 版本以来,这套字体以 SIL OFL 许可发布,并基于 #Chrome OS 核心字体。它们可作为 ttf-liberation 使用。虽然度量兼容,但整体字形风格与 Microsoft 和 Apple 的实现相当不同。

此字体的旧版本(基于 GPL 许可)基于 Ascender Corporation 的字体,该字体由 Red Hat, Inc. 授权。这些版本的 Liberation 也包括 Liberation Sans Narrow,它对应于 Arial Narrow。这一特定字体可作为 ttf-liberation-sans-narrowAUR 使用。

Ume

Ume 字体 (日语) (ttf-umeAUR) 是一个提供与 MS 日文字体度量兼容的字体的项目,例如:Ume Gothic (MS Gothic)、Ume UI Gothic (MS UI Gothic)、Ume P Gothic (MS PGothic) 等。

Google

Google 提供了大量字体,包括不同的度量兼容字体族。

Gelasio (ttf-gelasioAUR) 是 Google 的 Georgia 替代品,可在 FontLibrary 上以 SIL OFL 许可找到。

Chrome OS

Google 在其操作系统 Chrome OS 中随附了根据 Apache License 2.0 许可的开源度量兼容字体。CrOS core (croscore, ttf-croscore) 是 Arimo (无衬线)、Tinos (衬线) 和 Cousine (等宽) 的集合,同样授权自 Ascender Corporation。一套额外的字体 CrOS extra (crosextra) 提供了 Carlito (ttf-carlito) 和 Caladea (ttf-caladea) 以匹配 Microsoft Word 的默认字体。

由于 Symbol 的字形映射通常在浏览器中实现,Google 不再在 croscore > 1.23.0 中提供 SymbolNeu。您可以从 croscorefonts-1.23.0.tar.gz[失效链接 2025-11-17—HTTP 404] 获取此字体。

Noto

Google 的 Noto 字体可通过 noto-fonts 获取。它们根据 SIL OFL 许可。Noto 字体旨在补充 Roboto (ttf-roboto)(Android 的标准字体)的字形覆盖范围,并且在垂直方向(即相同字体大小具有相同的行高)上与 Roboto 度量兼容。

其他度量兼容字体

DMCA Sans Serif

DMCA Sans Serif (ttf-dmcasansserifAUR) 是 Microsoft Consolas 的通用无衬线替代品,它使用相同的度量(上 1884/2048,下 514/2048,宽 1126/2048)并且属于公共领域。9.0 版本包含 3309 个字符,即 Subset3+ 字符集。

Kissinger 2

Kissinger 2 是 Unifont 的公共领域竞争对手。与 Unifont 不同,Kissinger 2 被拆分为独立的半角 (8×16) 和全角 (16×16) 字体,部分字符在两种宽度中均有字形。dev5 版本包含 26466 个半角字符、38948 个全角字符、总计 63060 个字符以及 2354 个重叠字符。Kissinger 2 dev5 还包括用于阿拉伯语/希伯来语/泰语/越南语排版和组合标记正确对齐的 OpenType 功能,这可能也会影响度量兼容性。

Selawik

Selawik (ttf-selawikAUR) 是 Microsoft 的 Segoe UI 字体的开源替代品。遗憾的是,它不匹配 Segoe UI 的字距调整参数。它最初是为 WinJS 框架开发的,该框架现已被弃用。

Wine Tahoma

Wine 项目开发了一种度量兼容字体来替代 Microsoft 的 Tahoma,可作为 ttf-tahomaAUR 获取。它在 TTF 数据中的名称直接是“Tahoma”,因此无需任何配置。

示例配置

本文或本章节的准确性存在争议。

原因:我们不应在度量兼容字体页面讨论覆盖默认字体。我们应该做的只是建议用户在某些字体族名称前加上 binding="same" 以获得良好的后备方案(最好使用 <alias>...<accept> 速记法),而不是使用 strong 强制赋值完全替换原始字体。(在 Talk:Metric-compatible fonts 中讨论)

为了保持字体的一致性,所有应用程序都应设置为使用 serif、sans-serif 和 monospace 别名,这些别名通过 fontconfig 映射到特定字体。字体配置#设置默认或回退字体解释了实现该配置的两种方法,下文提供了针对度量兼容字体的配置示例。

绑定方法示例

以下配置示例使用了 #Liberation 字体。

/etc/fonts/local.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match target="pattern">
        <test qual="any" name="family"><string>serif</string></test>
        <edit name="family" mode="assign" binding="same"><string>Liberation Serif</string></edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family"><string>sans-serif</string></test>
        <edit name="family" mode="assign" binding="same"><string>Liberation Sans</string></edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family"><string>monospace</string></test>
        <edit name="family" mode="assign" binding="same"><string>Liberation Mono</string></edit>
    </match>
</fontconfig>

首选方法示例

以下配置示例使用了 #Chrome OS 字体,并添加了其他需要经常引用的字体的额外别名。

/etc/fonts/local.conf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
 
  <!-- Prefer fonts for generics -->
  <alias>
    <family>serif</family>
    <prefer><family>Tinos</family></prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer><family>Arimo</family></prefer>
  </alias>
  <alias>
    <family>sans</family>
    <prefer><family>Arimo</family></prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer><family>Cousine</family></prefer>
  </alias>
   
  <!-- Map specific families to CrOS ones -->
  <match>
    <test name="family"><string>Arial</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Arimo</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Helvetica</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Arimo</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Times</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Tinos</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Times New Roman</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Tinos</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Courier</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Cousine</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Courier New</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Cousine</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Calibri</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Carlito</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Cambria</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Caladea</string>
    </edit>
  </match> 
</fontconfig>

参见

© . 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.