Documentation
¶
Overview ¶
Package typeface reads the font files a deliverable ships and embeds: what each face is, how wide its text runs, whether it draws a character, and the forms Word (obfuscated TrueType) and PowerPoint (Embedded OpenType) embed, each compressed once per compile.
Index ¶
- Constants
- func Checkboxes(f *Family) (open, done, font string)
- func EOT(face *Face) ([]byte, error)
- func FontFaces(prefix string, families ...*Family) string
- func Glyph(f *Family, marks ...rune) string
- func Obfuscate(data []byte, key string) []byte
- func Tables(data []byte) (map[string][]byte, error)
- type Face
- type Family
- type Folder
- type Pack
- type Packed
- type Report
Constants ¶
const Symbols = "•–◦·☐☒□■❦❧◆—"
Symbols are the marks lfm sets: bullets, checkboxes, ornaments. Each falls back to one the font has.
Variables ¶
This section is empty.
Functions ¶
func Checkboxes ¶
Checkboxes are the open and done marks of task lists, and the font that draws them: the family's when it has them, else Arial, whose WGL4 set has □ and ■ in every app (LibreOffice maps it to Liberation Sans).
func EOT ¶
EOT wraps a TrueType font as Embedded OpenType 2.1, uncompressed: the .fntdata a .pptx embeds. PowerPoint for Windows and Mac show the deck in its fonts from it; the header repeats the font's OS/2 and name facts.
func FontFaces ¶
FontFaces are the CSS @font-face rules of the families' faces, each family once, loaded from prefix plus the file's base name.
Types ¶
type Face ¶
type Face struct {
File string // path below the deliverable folder
Family string // typographic family, as apps list it
Weight int // 400 regular, 700 bold
Italic bool
Embeddable bool // OS/2 fsType allows embedding in documents
Natural float64 // Word's single line height in em: (winAscent + winDescent) / unitsPerEm
Typo float64 // the typographic line in em, which Keynote and LibreOffice read
AvgChar float64 // average advance of running text in em
TabularDigits bool // 0-9 share one advance
Serif bool // OS/2 family class 1-7
Data []byte
Variable bool // an fvar table: Word and Pages need static fonts
// contains filtered or unexported fields
}
Face is one font file of the project: what it is and the metrics the layout and the design checks need.
type Family ¶
type Family struct {
Name string
Faces map[string]*Face // by slot: Regular, Bold, Italic, BoldItalic
}
Family is the faces of one font family a deliverable ships.
type Folder ¶
Folder is the fonts a deliverable ships in its fonts folder: the families by name and the licence files that travel with them.
type Pack ¶
type Pack struct {
// contains filtered or unexported fields
}
Pack compresses each embedded face once per compile: every file of a set embeds the same fonts, and deflating them is most of a build.