Font notes
Installing
Windows
Fonts that you downloaded yourself
- right-click the font file, click Install
- ...which is equivalent to copying them into the fonts directory, %windir%\Fonts (usually C:\Windows\Fonts)
Some fonts come with installers.
Linux
Ubuntu an the likes have some common fonts in their software center. If it's there, that's easiest, but there aren't a lot there.
If you downloaded it yourself, find the font file (probably .ttf or .otf), and
- if you're not an admin, you can copy the font file to ~/.local/share/fonts
- (~/.fonts may still work but is an older convention)
- if you want to install it system-wide (and are an admin), copy it to /usr/local/share/fonts
- (there may be further fonts, system fonts, located in /usr/share/fonts, that you can leave alone)
Window managers that use newer font systems will usually have a method of installing fonts, imitating the windows-style font directory handling:
- in GNOME, surf a Nautilus window to fonts:///
- in KDE, surf a Konqueror window to fonts:/ (or use the font installer in KDE's Control Center)
In both cases, you can copy the font file to this window - which actually places it in one of the system font directories.
In more classic setups, manual installation may have to be followed by a ttmkfdir (or type1inst for (Type 1) PostScript fonts) and/or a restart of your font manager, or possibly even of X -- but in modern setups it is often handled automatically.
OSX
https://support.apple.com/guide/font-book/install-and-validate-fonts-fntbk1000/mac
Base fonts
Specific contexts can be assumed to have specific sets of fonts, that you can assume are there and don't have to embed or install.
For example:
- PostScript defined its Base 35 fonts
- PDF has its Base 14 fonts
- Operating systems have had their own sets over time, less defined, and the stable subset tends to be small
Font types
- http://en.wikipedia.org/wiki/Category:Font_formats
- http://en.wikipedia.org/wiki/PostScript#Font_handling
- http://en.wikipedia.org/wiki/PostScript_fonts
- http://atrey.karlin.mff.cuni.cz/~milanek/PostScript/Reference/FontsIx.html
PostScript type something fonts
See also http://en.wikipedia.org/wiki/Adobe_Font_Metrics#Font_type
https://en.wikipedia.org/wiki/PostScript_fonts#Font_type
There are a bunch of these, though Type 1 and Type 3 seem most common (which relates to their use in PostScript (laser) printers(verify)).
Among the more common:
Type 1, PostScript Type 1, PS1, T1, Adobe Type 1
Type 3, PostScript Type 3 Font, PS3 or T3
Type 0
OCF and CID
PFB, PFA
Printer Font Binary (PFB) and Printer Font ASCII (PFA) are equivalent encodings of the same data.
Used by PostScript interpreters, and the preferred format for Type 1 fonts in *nix environments.
Metafont (bitmap)
Extensions: .gf, .pk
The output of Knuth's metafont is a bitmap font file in .gf (generic font) format, which is then often packed into an equivalent but more compressed .pk format.
The Computer Modern fonts were designed this way.
Truetype
Extensions: .ttf, .ttc
ttc is a TrueType Collection, which stores multiple fonts in a single file.
Opentype
Extensions: .otf, .ttf
Basically an open successor to TTF.
OpenType fonts may store TTF outlines, and if so usually have the .ttf extension(verify).
See also:
Embedded OpenType (EOT)
Extensions: .eot
Downloadable fonts, supported only by Internet Explorer.
http://en.wikipedia.org/wiki/Embedded_OpenType
Compact Font Format
Extensions: cff,
A.k.a. Type 2 font format, CFF/Type 2 font format.
Designed to store fonts more efficiently than Type 1 fonts, but functionally equivalent.
PDF can embed CFF since PDF version 1.2.
svg
BDF (bitmap)
Glyph Bitmap Distribution Format (BDF), was used in X windows
https://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format
PCF (bitmap)
Portable Compiled Format (PCF), replaced BDF around X windows, though X has mostly moved on to scalable fonts (OTF, TTF)
https://en.wikipedia.org/wiki/Portable_Compiled_Format
FON (bitmap)
(Windows)
NFNT (bitmap)
Metrics
AFM, PFM, ACFM, AMFM
Adobe Font Metrics, and a binary version called Printer Font Metric (PFM)
Related formats include Adobe Composite Font Metrics (ACFM), and Adobe Multiple Font Metrics (AMFM).
OFM
(OS/2)
MMM
(Windows)
OFF
Open Font Format is MPEG-4 Part 22.
And is basically OpenType v1.4
WOFF
Web Open Font Format is basically a wrapper around either OpenType and TrueType, and adds its own compression and some metadata.
Where TTF and OTF themselves makes sense for faster opening of a font already stored font on a device, WOFF makes sense to lessen transfers from a site.
WOFF2 is a revision with better compression.
See also:
- http://en.wikipedia.org/wiki/Web_Open_Font_Format
- Supported by most browsers:
INF
Part of uninstalled fonts to be installed by the Adobe Type Manager (ATM) utility used in the early windows era. ATM used .inf files to store metadata (e.g. names) and create a PFM to install based on an AFM file.
Font sets
Postscript fonts
Postscript itself uses a set of 35 fonts, a.k.a. 'Base 35', which are present in nearly all (Level 2) PostScript printers.
The PostScript fonts are licensed.
The URW donated a font set (GPL license, 1996) that strongly resembles the Postscript fonts, and can be used in PostScript-related situations.
In practice
CSS fonts
Note that you can 'compose' together multiple @font-face into one font-family name,e.g.
@font-face { font-family:"MyFont"; src:url("myfont-latin.woff2") format("woff2"); unicode-range:U+0000-00FF; } @font-face { font-family:"MyFont"; src:url("myfont-cyrillic.woff2") format("woff2"); unicode-range: U+0400-04FF; }
https://drafts.csswg.org/css-fonts/#composite-fonts
On font fallback, and font loading
A browser will know about the system fonts available, and the 'web fonts' - things defined by @font-face on that page.
Fallbacks
- When specifying font-face, use fallbacks in a list
- if you don't have a font, it falls back to the next in the list
- This is what frontend designers think about -- "I want all text to be rendered using this look", and "if you don't have font A I'll accept font B, etc."
- finishing with a generic family (like serif, sans-serif, monospace) helps the look stay vaguely consistent even if you have none of the specified fonts.
- Some argue that if you have no specific wish, you should really just stick to only specifying the generic family. At least you'll have consistency.
- note: font-family names are matched case-insensitively
- While you can only specify that fallback per elements, the browser's search for characters means is essentially per character.
- so it's not e.g. that an html element gets the first font that matches all characters in it
- (some extra details apply for combining-character sequences)
unicode-range lets you say you only want to consider this font for specific characters (into the @font-face you are defining)
- allows both 'only pick specific characters out of this font'
In theory, use of unicode-range mean a browser may choose to load that font only when a page uses a character in that range.
Practically:
- Most browsers seem to do this, effectively on-demand.
- Maybe you should not assume it, though, and some of them might try to be cleverer, e.g. still prefetching it for later(verify)
That said, if multiple fonts define overlapping unicode-range it won't just fetch the first.
font-family and unicode-range are fiters, font weight and style might would act as priorities if multiple are still available.
If weight and style re not specified -- so multiple might match equally -- it will probably still choose just one, but it's not defined to be the first.
See also:
- http://www.cs.tut.fi/~jkorpela/html/characters.html
- http://www.kendraschaefer.com/2012/06/chinese-standard-web-fonts-the-ultimate-guide-to-css-font-family-declarations-for-web-design-in-simplified-chinese/
font-display
Minimal font loading
TeX and bitmap fonts
Usual way to PostScript:
- .tex
- latex
- .dvi
- dvips -- needs a font map?
- .ps
This path usually rasterizes fonts -- usually at 600dpi (configurable), which is sharp enough for printing.
On screen this will always look blurrier than an outline font, because the raster characters have to be resized (and ClearType does not apply). (Note that some (PostScipt) viewers, particularly old versions, had nearest neighbour-esque resampling that meant they were fast but looked worse than necessary)
Using pslatex (either through \usepackage{pslatex}, or the pslatex command instead of latex+dvips) avoids font rasterisation, but does so by using only the set of PostScript fonts (times, helvetica, courier and a handful of variations) and thereby removes flexibility to use other fonts (including LaTeX's own Computer Modern fonts).
(How about the different ways to create a PDF? (verify))
Font tools
fontforge (has rudementary python bindings)
fontforge notes
See also:
Font terminology
See also: