Font notes

From Helpful
(Redirected from Woff)
Jump to navigation Jump to search
This article/section is a stub — probably a pile of half-sorted notes and is probably a first version, is not well-checked, so may have incorrect bits. (Feel free to ignore, or tell me)

Installing

Windows

In windows, installing fonts is done by copying them into the fonts directory, usually C:\Windows\Fonts

Linux

Modern X font subsystems tend to support TrueType fonts on top of the historically supported font types.

Basic system fonts are usually located in /usr/share/fonts, additional (possibly user-)installed system fonts in /usr/local/share/fonts, while user fonts can be placed in ~/.fonts.


The easy way

Window managers that use newer font systems will usually have a method of installing fonts, imitating the windows-style font directory handling:

  • in KDE, surf a Konqueror window to fonts:/ (or use the font installer in KDE's Control Center)
  • in GNOME, surf a Nautilus window to fonts:///

In both cases, you can copy the font file to this window - which actually places it in one of the system font directories.

The slightly harder way

Place the font in one of the system font directories.


In some 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 -- or it may be handled automatically.

Inspecting the fonts

There are a number of applications that you can use to inspect fonts and implicitly check whether one is installed (although a refresh in the halfway automatic installation methods also works).

Programs you can use include:

  • xlsfonts lists fonts served by font server (fslsfonts seems outdated?(verify))
  • kcharselect is the KDE font viewer
  • gfontview is the GNOME font viewer
  • xfontsel is an ugly/old plain-X font viewer


OSX

https://support.apple.com/guide/font-book/install-and-validate-fonts-fntbk1000/mac

Font types

This article/section is a stub — probably a pile of half-sorted notes and is probably a first version, is not well-checked, so may have incorrect bits. (Feel free to ignore, or tell me)

PostScript type something fonts

See also http://en.wikipedia.org/wiki/Adobe_Font_Metrics#Font_type

Among the more common:

Type 1, PostScript Type 1, PS1, T1, Adobe Type 1

This article/section is a stub — probably a pile of half-sorted notes and is probably a first version, is not well-checked, so may have incorrect bits. (Feel free to ignore, or tell me)

A simplification of PS to store outline information.



Type 3, PostScript Type 3 Font, PS3 or T3

This article/section is a stub — probably a pile of half-sorted notes and is probably a first version, is not well-checked, so may have incorrect bits. (Feel free to ignore, or tell me)



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.

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

This article/section is a stub — probably a pile of half-sorted notes and is probably a first version, is not well-checked, so may have incorrect bits. (Feel free to ignore, or tell me)


BDF (bitmap)

This article/section is a stub — probably a pile of half-sorted notes and is probably a first version, is not well-checked, so may have incorrect bits. (Feel free to ignore, or tell me)

Glyph Bitmap Distribution Format (BDF), was used in X windows

https://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format


PCF (bitmap)

This article/section is a stub — probably a pile of half-sorted notes and is probably a first version, is not well-checked, so may have incorrect bits. (Feel free to ignore, or tell me)

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)

This article/section is a stub — probably a pile of half-sorted notes and is probably a first version, is not well-checked, so may have incorrect bits. (Feel free to ignore, or tell me)

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

WOFF2 is a revision with better compression.

See also:

Other related files

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 font and character fallback

This article/section is a stub — probably a pile of half-sorted notes and is probably a first version, is not well-checked, so may have incorrect bits. (Feel free to ignore, or tell me)
  • if you don't have a font, it falls back to the next in the list
This is what most web 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


  • it seems that font family/face fallback is also effectively done for each 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)
can mess with styling - if a font designer was really lazy and really only did ASCII will you find that the occasional ñ or ă looks oddly different. (..but a lot of font have a whole bunch of extended Latin, so this particular example is rarely a problem)
  • if no font supports a character, a browser is allowed to load it from its own choice of fallback font, or insert some symbol to indicate the lack of character support


  • unicode-range lets you whitelist the characters to be taken from the font into the @font-face you are defining
A relatively new CSS3 feature. Most things support it now, but you may still want to think about what happens on non-supporting browsers)
It masks out everything else the font contains - characters outside the specified range will not be used which is meant as a feature, though can be a pain if you're doing something unusual
It also means the browser can decide not to download the font, if no character from that range are actually on the page (verify)
Example uses as a feature:
You want an ampersand from a specific font. Define the unicode-range for an alias to include only it, and every other character match will go to the next family in the list. See this example
When using CJK font, or specialized ones such as historical fonts, these characters may sometimes be covered by well-known fonts but look sort of ugly. You can effectively ask the browser to not use that. And effectively to avoid mixing CJK characters from different fonts, because that looks odd, but still have a fallback.


Unsorted:

  • It seems browsers may re-evaluate the character fallback once an external font is downloaded (can matter for very large fonts - things may move/flicker)


See also:


TeX and bitmap fonts

This article/section is a stub — probably a pile of half-sorted notes and is probably a first version, is not well-checked, so may have incorrect bits. (Feel free to ignore, or tell me)

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)

fonttools / ttx

ttfquery


fontforge notes

See also:

Font terminology

See also: