兼容度量字体

出自 ArchWiki

此条目或章节的事实准确性存在争议。

理由:视觉相似性与度量兼容性不同。例如,FreeSerif 在视觉上类似于 Times New Roman,但在度量上有所不同。TeX Gyre Termes 也是如此,但差异非常小。(在Talk:Metric-compatible fonts中讨论)

兼容度量字体是指其度量(即字形尺寸)与另一种字体(通常是 Helvetica、Times 或 Courier 等通用字体)相匹配的字体。由于其度量相匹配,将字体替换为度量兼容的替代字体不会更改文档或网页的格式。开发此类字体通常是为了让 FOSS 系统能够正确显示页面。

兼容度量字体的列表

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

“网页核心字体”兼容性
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
Symbol SymbolNeu
Microsoft UI 字体
Microsoft FOSS
Segoe UI Selawik
Tahoma Wine Tahoma
顶部 1884÷2048em,底部 514÷2048em,宽度 1126÷2048em 的字体
Microsoft Type Design
Consolas DMCA Sans Serif
带有 8×16 字形和 16×16 字形的字体
GNU Type Design
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 发布了这 35 种字体的开源版本/克隆,用于 w:ghostscript,可作为 gsfonts 使用。包括 GUST 的 TeX GyreGNU FreeFont 在内的项目发布了这些字体的增强版本。

PostScript 3 定义了额外的 101 种字体,其中许多字体由 URW 在 AFPL 下在 GhostPDL[失效链接 2025-01-22 ⓘ] 中提供。AFPL 禁止商业用途。许多双字体名称是由 批量更新[失效链接 2025-01-22 ⓘ] 引起的。

Garamond

URW 的 Garamond No.8 仅提供一种光学尺寸 (8pt)。您可以将 EB Garamond 用于更多 OpenType 功能,包括 12pt 尺寸。但是,不能保证它在度量上完全相同。

Microsoft

Microsoft 将许多字体与 Microsoft Windows 和 Microsoft Office 捆绑在一起。虽然其中一些字体只是相应 PostScript 字体族的廉价版本(或外观相似的版本),但 Cambria 和 Calibri(自 MS Office 2007 以来的默认字体)与其他字体族无关。Microsoft 曾经在其 网页核心字体 项目中提供了许多核心字体。虽然此项目后来在 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 发布。

Liberation

Liberation fonts 提供了 Liberation Sans、Liberation Serif 和 Liberation Mono 四个字体族,旨在与常见的 Microsoft Windows 字体度量兼容。自 2.0.0 版本起,这组字体根据 SIL OFL 发布,并且基于 #Chrome OS 核心字体。它们可作为 ttf-liberation 使用。

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

Ume

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

Google

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

Gelasio[失效链接 2024-01-13 ⓘ] (ttf-gelasio-ibAUR),Georgia 的 Google 替代品,可以在 FontLibrary 上找到,根据 SIL OFL 许可。

Chrome OS

Google 在其操作系统 Chrome OS 中附带了开源的度量兼容字体,根据 Apache License 2.0 许可。CrOS core (croscore, ttf-croscore) 是 Arimo (sans)、Tinos (serif) 和 Cousine (mono) 的集合,也从 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 获取此字体。

Noto

Google 的 Noto 字体 可通过 noto-fonts 获得。它们根据 SIL OFL 许可。Noto 字体旨在补充 Roboto (ttf-roboto) 的字形覆盖范围,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) 字体,某些字符在两种宽度中都有字形。dev4 版本有 8450 个半宽字符、14724 个全宽字符、总共 21911 个,以及 1263 个重叠,但是,用户可以通过官方网站上描述的方法贡献字形。

Selawik

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

Wine Tahoma

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

配置示例

此条目或章节的事实准确性存在争议。

理由:我们不应该在度量兼容字体页面中讨论覆盖默认字体。我们应该做的只是告诉人们为良好的回退预先添加 binding="same" 一些字体族名称(最好使用简写 <alias>...<accept>),而不是完全用强力赋值替换原始字体。(在 Talk:Metric-compatible fonts 中讨论)

为了字体一致性,所有应用程序都应设置为使用衬线字体、无衬线字体和等宽字体别名,这些别名通过 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>

参见