Compatifont

Compatifont is a collection of open fonts that replace the fonts of Windows and Office, such as Arial, Calibri and Times New Roman. Each font keeps the advance widths of the font it replaces, so a document breaks its lines and pages in the same places.

The fonts are free to use and to share under the SIL Open Font License. Their letters are drawn from open fonts such as Arimo and Carlito, while their advance widths and line heights are those of the fonts they replace. For every font, a check file records which values equal the closed font’s and which still differ.

Compatifont is also a file format and a checker that work for any font. A compatifont.toml file names the fonts that a font can replace, and compatifont check measures that claim against the font files.

Download every font (.zip) Source code on GitHub

Hamburgefonstiv
Arimo CF Bold. Type designers try a typeface on the word Hamburgefonstiv, which holds most of the shapes that the other letters are made of.

Fonts

Each font tracks the layout of one font of Windows or Office, named before it. A place is one character in one style, and the advance widths count the places where the check compared the two fonts. The level is widths when every advance width is equal, and layout when every value that text layout reads is equal too. The specification lists those values.

  1. 1 Replaces Arial Arimo CF
    Advance widths
    equal in all 12,634 places
    Level
    widths1
    Styles
    4
  2. 2 Replaces Times New Roman Tinos CF
    Advance widths
    equal in all 13,322 places
    Level
    widths2
    Styles
    4
  3. 3 Replaces Calibri Celeborn CF
    Advance widths
    equal in all 12,188 places
    Level
    widths
    Styles
    4
  4. 4 Replaces Comic Sans MS Comic Relief CF
    Advance widths
    equal in all 2,812 places
    Level
    widths
    Styles
    4
  5. 5 Replaces Symbol, Wingdings, Wingdings 2, Wingdings 3 and Webdings Noto Symbols CF
    Advance widths
    none shared, by a map of characters
    Level
    none
    Styles
    1
  6. 6 Replaces Cambria Caladea CF
    Advance widths
    equal in all 4,644 places
    Level
    widths
    Styles
    4
  7. 7 Replaces Cambria Math Caladea Math CF
    Advance widths
    equal in all 4,515 places
    Level
    widths
    Styles
    1
  8. 8 Replaces Aptos Intos CF
    Advance widths
    equal in all 4,344 places
    Level
    widths
    Styles
    4
  9. 9 Replaces Courier New Curunír CF
    Advance widths
    equal in all 11,055 places
    Level
    widths
    Styles
    4
  10. 10 Replaces Arial Narrow Arimo Narrow CF
    Advance widths
    equal in all 2,624 places
    Level
    layout
    Styles
    4
  11. 11 Replaces Aptos Display Intos Display CF
    Advance widths
    equal in all 3,258 places
    Level
    widths
    Styles
    3
  12. 12 Replaces Georgia Gelasio CF
    Advance widths
    equal in all 2,478 places
    Level
    widths
    Styles
    4
  13. 13 Replaces Segoe UI Sindar CF
    Advance widths
    equal in all 13,811 places
    Level
    widths
    Styles
    4
  1. Arimo CF reaches layout in Latin, Cyrillic, Greek, Armenian, Coptic, Bopomofo, combining marks and unassigned, and widths in all of Arial. ↩
  2. Tinos CF reaches layout in Latin, Cyrillic, Greek, Armenian, Coptic, Bopomofo and unassigned, and widths in all of Times New Roman. ↩

Comparison

This tool sets your text in a Compatifont font and, if your computer has it, in the font that it replaces, then measures every line in both. Kerning and ligatures stay off unless you turn them on, so the width of a line is the sum of its advance widths.

Installation

Desktop

The release holds the faces of every font in one zip file, compatifont-all-v0.1.0.zip. Install them as you install any font. Each font’s page also links its own zip file.

Linux

These commands install every font for your user and refresh the font cache.

Shell
curl -LO \
  https://github.com/osolmaz/compatifont/releases/download/v0.1.0/compatifont-all-v0.1.0.zip
unzip compatifont-all-v0.1.0.zip -d ~/.local/share/fonts/compatifont
fc-cache -f

To make programs that ask for Arial use Arimo CF, and the same for the other fonts, write fontconfig aliases from a clone of the repository:

Shell
cargo install compatifont-cli
git clone https://github.com/osolmaz/compatifont && cd compatifont
mkdir -p ~/.config/fontconfig/conf.d
compatifont export fontconfig > ~/.config/fontconfig/conf.d/60-compatifont.conf

Web pages

The CDN serves every face with open CORS and a cache of one year, so a page can load a font straight from it:

CSS
@font-face {
  font-family: "Celeborn CF";
  src: url("https://cdn.compatifont.com/v0.1.2/celeborn-cf/files/CelebornCF-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}

body { font-family: "Celeborn CF", Calibri, sans-serif; }

JavaScript

The npm package holds the catalog of fonts and a fetcher that downloads the faces of a font when they are needed and checks each against its SHA-256.

Shell
npm install @compatifont/fonts
JavaScript
import { fontFetcher, resolveFamily } from "@compatifont/fonts";

resolveFamily("Calibri")?.familyName; // "Celeborn CF"
const fetchFont = fontFetcher();
const faces = await fetchFont("Calibri"); // Uint8Array[], each checked against its SHA-256

To serve the files from your own site, copy them into it and point the fetcher there:

Shell
npx @compatifont/fonts sync --out public/fonts
JavaScript
const fetchFont = fontFetcher({ baseUrl: "/fonts" });

Rust

The crate compatifont-fonts compiles the fonts into a program, with one feature for each font.

Shell
cargo add compatifont-fonts --features arimo-cf

Description format

A description is a TOML file, compatifont.toml, about one font family. It lists the family’s files with their SHA-256, and for each font that the family can replace, the items that are equal. An item is one value or table of a font, named as OpenType names it, such as hhea.ascender or GPOS.kern. An item that the file does not list is unchecked.

Carlito’s maker says that Carlito has the advance widths of Calibri. Carlito’s description records the claim like this:

TOML
[[compatible_with]]
family_name = "Calibri"
basis = "maker"
reference = "https://github.com/googlefonts/carlito"

[compatible_with.subfamilies]
Regular = "Regular"
Bold = "Bold"
Italic = "Italic"
"Bold Italic" = "Bold Italic"

[compatible_with.items]
"hmtx.advanceWidth" = "equal"

The basis says where a claim comes from: maker for the font’s maker, list for a known list of substitutes, and check when compatifont check measured the files. A check file stores results, counts, versions and SHA-256 digests, and never a table or an outline of either font, so it can be published even when the closed font’s license forbids sharing the font.

The specification defines every item and level. The Rust crate compatifont reads descriptions and chooses a replacement for a font that a document asks for, and compatifont-cli runs the checks.

Other makers’ fonts

Many open fonts claim the widths of a closed font. Measured against the fonts that come with Windows and Office, most of these claims hold for some characters only. Each row is one check, stored in the repository’s examples/ folder.

FontReplacesClaimedMeasured advance widths
Arimo 1.33 Arial 7.06 equal widths differ in 1,089 of 10,272 places: Cyrillic, Greek, Hebrew, Latin, common signs
Caladea 1.001 Cambria 6.98 equal widths differ in 981 of 1,292 places: Greek, Latin, common signs
Caladea 1.001 Cambria 6.99 (Regular only) equal widths differ in 296 of 434 places: Latin, common signs
Carlito 1.104 Calibri 6.27 equal widths differ in 11 of 8,448 places: Latin
Comic Relief 1.300 Comic Sans MS 5.15 equal widths differ in 12 of 1,166 places: Cyrillic, Greek, Latin, common signs
Cousine 1.241 Courier New 6.95 no claim differ in 808 of 9,024 places: Cyrillic, Greek, Hebrew, combining marks, common signs
Gelasio 1.008 Georgia 5.59 equal widths differ in 103 of 1,796 places: Greek, Latin, combining marks, common signs
Intos 1.000 Aptos 2.01 equal widths, equal kerning equal in all 3,948 places
Intos Display 1.000 Aptos Display 2.01 equal widths equal in all 2,961 places
Liberation Mono 2.1.5 Courier New 6.95 equal widths differ in 808 of 9,024 places: Cyrillic, Greek, Hebrew, combining marks, common signs
Liberation Sans 2.1.5 Arial 7.06 equal widths differ in 354 of 9,188 places: Cyrillic, Hebrew, common signs
Liberation Serif 2.1.5 Times New Roman 7.12 equal widths differ in 424 of 9,232 places: Cyrillic, Hebrew, common signs
Nimbus Sans Narrow 1.00 Arial Narrow 2.40 no claim differ in 937 of 2,620 places: Cyrillic, Greek, Latin, common signs
P052 1.00 Book Antiqua 2.35 (Regular only) no claim differ in 306 of 651 places: Cyrillic, Greek, Latin, common signs
P052 1.00 Palatino Linotype 5.03 equal widths differ in 1,222 of 2,556 places: Cyrillic, Greek, Latin, common signs
Selawik 1.01 Segoe UI 5.71 kerning differs differ in 499 of 1,740 places: Latin, combining marks, common signs
Tinos 1.340 Times New Roman 7.12 equal widths differ in 1,699 of 11,152 places: Cyrillic, Greek, Hebrew, Latin, common signs
URW Bookman 1.00 Bookman Old Style 2.35 equal widths differ in 708 of 1,953 places: Cyrillic, Greek, Latin, common signs
URW Bookman 1.00 Bookman Old Style 2.36 (Italic only) equal widths differ in 238 of 651 places: Cyrillic, Greek, Latin, common signs