ttf

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Subset

func Subset(f *sfnt.Font, src []byte, cutset map[rune]struct{}) ([]byte, error)

Subset is something of a poor man's subsetting function. It works - for TrueType fonts with 'glyf' tables only - by zeroing out the outlines of all glyphs not corresponding to or directly referenced by f's glyphs for the runes in cutset, truncating f's glyf and loca tables, and then writing only the required tables to the returned byte slice. The final subset font contains cmap, glyf, head, hhea, hmtx, loca, and maxp tables. The glyph indices are not affected. src should be a copy of the source bytes for f, since the underlying bytes used by f should not be accessed while f is in use.

Types

type TableTag added in v0.0.9

type TableTag uint32
const (
	Cmap TableTag = 'c'<<24 | 'm'<<16 | 'a'<<8 | 'p'
	Glyf TableTag = 'g'<<24 | 'l'<<16 | 'y'<<8 | 'f'
	Head TableTag = 'h'<<24 | 'e'<<16 | 'a'<<8 | 'd'
	Hhea TableTag = 'h'<<24 | 'h'<<16 | 'e'<<8 | 'a'
	Hmtx TableTag = 'h'<<24 | 'm'<<16 | 't'<<8 | 'x'
	Loca TableTag = 'l'<<24 | 'o'<<16 | 'c'<<8 | 'a'
	Maxp TableTag = 'm'<<24 | 'a'<<16 | 'x'<<8 | 'p'
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL