font

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MPL-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// sfnt2Woff offset
	SFNT_OFFSET_TAG      = 0
	SFNT_OFFSET_CHECKSUM = 4
	SFNT_OFFSET_OFFSET   = 8
	SFNT_OFFSET_LENGTH   = 12

	// sfnt2Woff entry offset
	SFNT_ENTRY_OFFSET_FLAVOR              = 0
	SFNT_ENTRY_OFFSET_VERSION_MAJ         = 4
	SFNT_ENTRY_OFFSET_VERSION_MIN         = 6
	SFNT_ENTRY_OFFSET_CHECKSUM_ADJUSTMENT = 8

	// woff offset
	WOFF_OFFSET_MAGIC            = 0
	WOFF_OFFSET_FLAVOR           = 4
	WOFF_OFFSET_SIZE             = 8
	WOFF_OFFSET_NUM_TABLES       = 12
	WOFF_OFFSET_RESERVED         = 14
	WOFF_OFFSET_SFNT_SIZE        = 16
	WOFF_OFFSET_VERSION_MAJ      = 20
	WOFF_OFFSET_VERSION_MIN      = 22
	WOFF_OFFSET_META_OFFSET      = 24
	WOFF_OFFSET_META_LENGTH      = 28
	WOFF_OFFSET_META_ORIG_LENGTH = 32
	WOFF_OFFSET_PRIV_OFFSET      = 36
	WOFF_OFFSET_PRIV_LENGTH      = 40

	// woff entry offset
	WOFF_ENTRY_OFFSET_TAG          = 0
	WOFF_ENTRY_OFFSET_OFFSET       = 4
	WOFF_ENTRY_OFFSET_COMPR_LENGTH = 8
	WOFF_ENTRY_OFFSET_LENGTH       = 12
	WOFF_ENTRY_OFFSET_CHECKSUM     = 16

	// magic
	MAGIC_WOFF                uint32 = 0x774f4646
	MAGIC_CHECKSUM_ADJUSTMENT uint32 = 0xb1b0afba

	// sizes
	SIZE_OF_WOFF_HEADER      = 44
	SIZE_OF_WOFF_ENTRY       = 20
	SIZE_OF_SFNT_HEADER      = 12
	SIZE_OF_SFNT_TABLE_ENTRY = 16
)

Functions

func Sfnt2Woff

func Sfnt2Woff(fontBuf []byte) ([]byte, error)

func UTF8CutFont added in v0.5.0

func UTF8CutFont(inBuf []byte, cutset string) (outBuf []byte)

UTF8CutFont is a utility function that generates a TrueType font composed only of the runes included in cutset. The rune glyphs are copied from This function is demonstrated in ExampleUTF8CutFont().

Types

type TableEntry

type TableEntry struct {
	Tag      []byte
	CheckSum uint32
	Offset   uint32
	Length   uint32
}

Jump to

Keyboard shortcuts

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