tables

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: BSD-3-Clause, Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Kerx1Push        = 0x8000 // If set, push this glyph on the kerning stack.
	Kerx1DontAdvance = 0x4000 // If set, don't advance to the next glyph before going to the new state.
	Kerx1Reset       = 0x2000 // If set, reset the kerning data (clear the stack)
	Kern1Offset      = 0x3FFF // Byte offset from beginning of subtable to the  value table for the glyphs on the kerning stack.
)

Kernx1 state entry flags

View Source
const (
	// Push this glyph onto the component stack for
	// eventual processing.
	MLSetComponent = 0x8000
	// Leave the glyph pointer at this glyph for the
	// next iteration.
	MLDontAdvance = 0x4000
	// Use the ligActionIndex to process a ligature group.
	MLPerformAction = 0x2000
	// Byte offset from beginning of subtable to the
	// ligature action list. This value must be a
	// multiple of 4.
	MLOffset = 0x3FFF

	// This is the last action in the list. This also
	// implies storage.
	MLActionLast = 1 << 31
	// Store the ligature at the current cumulated index
	// in the ligature table in place of the marked
	// (i.e. currently-popped) glyph.
	MLActionStore = 1 << 30
	// A 30-bit value which is sign-extended to 32-bits
	// and added to the glyph ID, resulting in an index
	// into the component table.
	MLActionOffset = 0x3FFFFFFF
)

MorxLigatureSubtable flags

View Source
const (
	// If set, mark the current glyph.
	MISetMark = 0x8000
	// If set, don't advance to the next glyph before
	// going to the new state.  This does not mean
	// that the glyph pointed to is the same one as
	// before. If you've made insertions immediately
	// downstream of the current glyph, the next glyph
	// processed would in fact be the first one
	// inserted.
	MIDontAdvance = 0x4000
	// If set, and the currentInsertList is nonzero,
	// then the specified glyph list will be inserted
	// as a kashida-like insertion, either before or
	// after the current glyph (depending on the state
	// of the currentInsertBefore flag). If clear, and
	// the currentInsertList is nonzero, then the
	// specified glyph list will be inserted as a
	// split-vowel-like insertion, either before or
	// after the current glyph (depending on the state
	// of the currentInsertBefore flag).
	MICurrentIsKashidaLike = 0x2000
	// If set, and the markedInsertList is nonzero,
	// then the specified glyph list will be inserted
	// as a kashida-like insertion, either before or
	// after the marked glyph (depending on the state
	// of the markedInsertBefore flag). If clear, and
	// the markedInsertList is nonzero, then the
	// specified glyph list will be inserted as a
	// split-vowel-like insertion, either before or
	// after the marked glyph (depending on the state
	// of the markedInsertBefore flag).
	MIMarkedIsKashidaLike = 0x1000
	// If set, specifies that insertions are to be made
	// to the left of the current glyph. If clear,
	// they're made to the right of the current glyph.
	MICurrentInsertBefore = 0x0800
	// If set, specifies that insertions are to be
	// made to the left of the marked glyph. If clear,
	// they're made to the right of the marked glyph.
	MIMarkedInsertBefore = 0x0400
	// This 5-bit field is treated as a count of the
	// number of glyphs to insert at the current
	// position. Since zero means no insertions, the
	// largest number of insertions at any given
	// current location is 31 glyphs.
	MICurrentInsertCount = 0x3E0
	// This 5-bit field is treated as a count of the
	// number of glyphs to insert at the marked
	// position. Since zero means no insertions, the
	// largest number of insertions at any given
	// marked location is 31 glyphs.
	MIMarkedInsertCount = 0x001F
)

MorxInsertionSubtable flags

View Source
const (
	PEUnicodeDefault     = EncodingID(0)
	PEUnicodeBMP         = EncodingID(3)
	PEUnicodeFull        = EncodingID(4)
	PEUnicodeFull13      = EncodingID(6)
	PEMacRoman           = PEUnicodeDefault
	PEMicrosoftSymbolCs  = EncodingID(0)
	PEMicrosoftUnicodeCs = EncodingID(1)
	PEMicrosoftUcs4      = EncodingID(10)
)

Variables

This section is empty.

Functions

func DecodeMacintosh

func DecodeMacintosh(encoded []byte) string

DecodeMacintosh decode a Macintosh encoded string

func DecodeMacintoshByte

func DecodeMacintoshByte(b byte) rune

DecodeMacintoshByte returns the rune for the given byte

func Float1616ToUint

func Float1616ToUint(f Float1616) uint32

func Float214FromUint

func Float214FromUint(v uint16) float32

func ParseLoca

func ParseLoca(src []byte, numGlyphs int, isLong bool) (out []uint32, err error)

shared with gvar, sbix, eblc return an error only if data is not long enough

func ParseUint16s

func ParseUint16s(src []byte, count int) ([]uint16, error)

ParseUint16s interprets data as a (big endian) uint16 slice. It returns an error if [data] is not long enough for the given [count].

Types

type AATFeature

type AATFeature struct {
	FeatureType    uint16
	FeatureSetting uint16
	EnableFlags    uint32 // Flags for the settings that this feature and setting enables.
	DisableFlags   uint32 // Complement of flags for the settings that this feature and setting disable.
}

type AATKernSubtableHeader

type AATKernSubtableHeader struct {
	Coverage byte // Circumstances under which this table is used.

	TupleCount uint16 // The tuple count. This value is only used with variation fonts and should be 0 for all other fonts. The subtable's tupleCount will be ignored if the 'kerx' table version is less than 4.
	// contains filtered or unexported fields
}

func ParseAATKernSubtableHeader

func ParseAATKernSubtableHeader(src []byte) (AATKernSubtableHeader, int, error)

func (AATKernSubtableHeader) Data

type AATLookup

type AATLookup interface {
	AatLookupMixed

	// Class returns the class ID for the provided glyph, or (0, false)
	// for glyphs not covered by this class.
	Class(g GlyphID) (uint16, bool)
	// contains filtered or unexported methods
}

AATLookup is conceptually a map[GlyphID]uint16, but it may be implemented more efficiently.

func ParseAATLookup

func ParseAATLookup(src []byte, valuesCount int) (AATLookup, int, error)

type AATLookupExt

type AATLookupExt interface {
	AatLookupMixed

	// Class returns the class ID for the provided glyph, or (0, false)
	// for glyphs not covered by this class.
	Class(g GlyphID) (uint32, bool)
	// contains filtered or unexported methods
}

AATLookupExt is the same as AATLookup, but class values are uint32

func ParseAATLookupExt

func ParseAATLookupExt(src []byte, valuesCount int) (AATLookupExt, int, error)

type AATLookupRecord4

type AATLookupRecord4 struct {
	LastGlyph  GlyphID
	FirstGlyph GlyphID
	// offset to an array of []uint16 (or []uint32 for extended) with length last - first + 1
	Values []uint16 `offsetSize:"Offset16" offsetRelativeTo:"Parent" arrayCount:"ComputedField-nValues()"`
}

func ParseAATLookupRecord4

func ParseAATLookupRecord4(src []byte, parentSrc []byte) (AATLookupRecord4, int, error)

type AATLoopkup0

type AATLoopkup0 struct {
	Values []uint16 `arrayCount:""`
	// contains filtered or unexported fields
}

func ParseAATLoopkup0

func ParseAATLoopkup0(src []byte, valuesCount int) (AATLoopkup0, int, error)

func (AATLoopkup0) Class

func (lk AATLoopkup0) Class(g GlyphID) (uint16, bool)

func (AATLoopkup0) ClassUint32

func (lk AATLoopkup0) ClassUint32(g GlyphID) uint32

type AATLoopkup10

type AATLoopkup10 struct {
	FirstGlyph GlyphID
	Values     []uint16 `arrayCount:"FirstUint16"`
	// contains filtered or unexported fields
}

func ParseAATLoopkup10

func ParseAATLoopkup10(src []byte) (AATLoopkup10, int, error)

func (AATLoopkup10) Class

func (lk AATLoopkup10) Class(g GlyphID) (uint16, bool)

func (AATLoopkup10) ClassUint32

func (lk AATLoopkup10) ClassUint32(g GlyphID) uint32

type AATLoopkup2

type AATLoopkup2 struct {
	Records []LookupRecord2 `arrayCount:"ComputedField-nUnits"`
	// contains filtered or unexported fields
}

func ParseAATLoopkup2

func ParseAATLoopkup2(src []byte) (AATLoopkup2, int, error)

func (AATLoopkup2) Class

func (lk AATLoopkup2) Class(g GlyphID) (uint16, bool)

func (AATLoopkup2) ClassUint32

func (lk AATLoopkup2) ClassUint32(g GlyphID) uint32

type AATLoopkup4

type AATLoopkup4 struct {

	// Do not include the termination segment
	Records []AATLookupRecord4 `arrayCount:"ComputedField-nUnits-1"`
	// contains filtered or unexported fields
}

func ParseAATLoopkup4

func ParseAATLoopkup4(src []byte) (AATLoopkup4, int, error)

func (AATLoopkup4) Class

func (lk AATLoopkup4) Class(g GlyphID) (uint16, bool)

func (AATLoopkup4) ClassUint32

func (lk AATLoopkup4) ClassUint32(g GlyphID) uint32

type AATLoopkup6

type AATLoopkup6 struct {
	Records []loopkupRecord6 `arrayCount:"ComputedField-nUnits"`
	// contains filtered or unexported fields
}

func ParseAATLoopkup6

func ParseAATLoopkup6(src []byte) (AATLoopkup6, int, error)

func (AATLoopkup6) Class

func (lk AATLoopkup6) Class(g GlyphID) (uint16, bool)

func (AATLoopkup6) ClassUint32

func (lk AATLoopkup6) ClassUint32(g GlyphID) uint32

type AATLoopkup8

type AATLoopkup8 struct {
	AATLoopkup8Data
	// contains filtered or unexported fields
}

func ParseAATLoopkup8

func ParseAATLoopkup8(src []byte) (AATLoopkup8, int, error)

func (AATLoopkup8) ClassUint32

func (lk AATLoopkup8) ClassUint32(g GlyphID) uint32

type AATLoopkup8Data

type AATLoopkup8Data struct {
	FirstGlyph GlyphID
	Values     []uint16 `arrayCount:"FirstUint16"`
}

func ParseAATLoopkup8Data

func ParseAATLoopkup8Data(src []byte) (AATLoopkup8Data, int, error)

func (AATLoopkup8Data) Class

func (lk AATLoopkup8Data) Class(g GlyphID) (uint16, bool)

type AATLoopkupExt0

type AATLoopkupExt0 struct {
	Values []uint32 `arrayCount:""`
	// contains filtered or unexported fields
}

func ParseAATLoopkupExt0

func ParseAATLoopkupExt0(src []byte, valuesCount int) (AATLoopkupExt0, int, error)

func (AATLoopkupExt0) Class

func (lk AATLoopkupExt0) Class(g GlyphID) (uint32, bool)

func (AATLoopkupExt0) ClassUint32

func (lk AATLoopkupExt0) ClassUint32(g GlyphID) uint32

type AATLoopkupExt10

type AATLoopkupExt10 struct {
	FirstGlyph GlyphID
	Values     []uint32 `arrayCount:"FirstUint16"`
	// contains filtered or unexported fields
}

func ParseAATLoopkupExt10

func ParseAATLoopkupExt10(src []byte) (AATLoopkupExt10, int, error)

func (AATLoopkupExt10) Class

func (lk AATLoopkupExt10) Class(g GlyphID) (uint32, bool)

func (AATLoopkupExt10) ClassUint32

func (lk AATLoopkupExt10) ClassUint32(g GlyphID) uint32

type AATLoopkupExt2

type AATLoopkupExt2 struct {
	Records []lookupRecordExt2 `arrayCount:"ComputedField-nUnits"`
	// contains filtered or unexported fields
}

func ParseAATLoopkupExt2

func ParseAATLoopkupExt2(src []byte) (AATLoopkupExt2, int, error)

func (AATLoopkupExt2) Class

func (lk AATLoopkupExt2) Class(g GlyphID) (uint32, bool)

func (AATLoopkupExt2) ClassUint32

func (lk AATLoopkupExt2) ClassUint32(g GlyphID) uint32

type AATLoopkupExt4

type AATLoopkupExt4 struct {

	// the values pointed by the record are uint32
	Records []loopkupRecordExt4 `arrayCount:"ComputedField-nUnits"`
	// contains filtered or unexported fields
}

func ParseAATLoopkupExt4

func ParseAATLoopkupExt4(src []byte) (AATLoopkupExt4, int, error)

func (AATLoopkupExt4) Class

func (lk AATLoopkupExt4) Class(g GlyphID) (uint32, bool)

func (AATLoopkupExt4) ClassUint32

func (lk AATLoopkupExt4) ClassUint32(g GlyphID) uint32

type AATLoopkupExt6

type AATLoopkupExt6 struct {
	Records []loopkupRecordExt6 `arrayCount:"ComputedField-nUnits"`
	// contains filtered or unexported fields
}

func ParseAATLoopkupExt6

func ParseAATLoopkupExt6(src []byte) (AATLoopkupExt6, int, error)

func (AATLoopkupExt6) Class

func (lk AATLoopkupExt6) Class(g GlyphID) (uint32, bool)

func (AATLoopkupExt6) ClassUint32

func (lk AATLoopkupExt6) ClassUint32(g GlyphID) uint32

type AATLoopkupExt8

type AATLoopkupExt8 AATLoopkup8

func ParseAATLoopkupExt8

func ParseAATLoopkupExt8(src []byte) (AATLoopkupExt8, int, error)

func (AATLoopkupExt8) Class

func (lk AATLoopkupExt8) Class(g GlyphID) (uint32, bool)

func (AATLoopkupExt8) ClassUint32

func (lk AATLoopkupExt8) ClassUint32(g GlyphID) uint32

type AATStateEntry

type AATStateEntry struct {
	NewState uint16
	Flags    uint16 // Table specific.
	// contains filtered or unexported fields
}

AATStateEntry is shared between old and extended state tables, and between the different kind of entries. See the various AsXXX() methods.

func (AATStateEntry) AsKernxIndex

func (e AATStateEntry) AsKernxIndex() uint16

AsKernxIndex reads the internal data for entries in 'kern/x' subtable format 1 or 4. An entry with no index returns 0xFFFF

func (AATStateEntry) AsMorxContextual

func (e AATStateEntry) AsMorxContextual() (markIndex, currentIndex uint16)

AsMorxContextual reads the internal data for entries in morx contextual subtable. The returned indexes use 0xFFFF as empty value.

func (AATStateEntry) AsMorxInsertion

func (e AATStateEntry) AsMorxInsertion() (currentIndex, markedIndex uint16)

AsMorxInsertion reads the internal data for entries in morx insertion subtable. The returned indexes use 0xFFFF as empty value.

func (AATStateEntry) AsMorxLigature

func (e AATStateEntry) AsMorxLigature() (ligActionIndex uint16)

AsMorxLigature reads the internal data for entries in morx ligature subtable.

type AATStateTable

type AATStateTable struct {
	StateSize  uint16     // Size of a state, in bytes. The size is limited to 8 bits, although the field is 16 bits for alignment.
	ClassTable ClassTable `offsetSize:"Offset16"` // Byte offset from the beginning of the state table to the class subtable.

	States  [][]uint8       `isOpaque:""`
	Entries []AATStateEntry `isOpaque:""` // entry data are empty
	// contains filtered or unexported fields
}

State table header, without the actual data See https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6Tables.html

func ParseAATStateTable

func ParseAATStateTable(src []byte) (AATStateTable, int, error)

type AATStateTableExt

type AATStateTableExt struct {
	StateSize uint32    // Size of a state, in bytes. The size is limited to 8 bits, although the field is 16 bits for alignment.
	Class     AATLookup `offsetSize:"Offset32"` // Byte offset from the beginning of the state table to the class subtable.

	States  [][]uint16      `isOpaque:""` // each sub array has length stateSize
	Entries []AATStateEntry `isOpaque:""` // length is the maximum state + 1
	// contains filtered or unexported fields
}

Extended state table, including the data See https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6Tables.html - State tables binarygen: argument=entryDataSize int

func ParseAATStateTableExt

func ParseAATStateTableExt(src []byte, valuesCount int, entryDataSize int) (AATStateTableExt, int, error)

type AatLookupMixed

type AatLookupMixed interface {
	// Returns 0 if not supported
	ClassUint32(GlyphID) uint32
}

type AlternateSet

type AlternateSet struct {
	AlternateGlyphIDs []GlyphID `arrayCount:"FirstUint16"` // Array of alternate glyph IDs, in arbitrary order
}

func ParseAlternateSet

func ParseAlternateSet(src []byte) (AlternateSet, int, error)

type AlternateSubs

type AlternateSubs struct {
	Coverage      Coverage       `offsetSize:"Offset16"` //	Offset to Coverage table, from beginning of substitution subtable
	AlternateSets []AlternateSet `arrayCount:"FirstUint16"  offsetsArray:"Offset16"`
	// contains filtered or unexported fields
}

func ParseAlternateSubs

func ParseAlternateSubs(src []byte) (AlternateSubs, int, error)

func (AlternateSubs) Cov

func (lk AlternateSubs) Cov() Coverage

type Anchor

type Anchor interface {
	// contains filtered or unexported methods
}

func ParseAnchor

func ParseAnchor(src []byte) (Anchor, int, error)

type AnchorFormat1

type AnchorFormat1 struct {
	XCoordinate int16 // Horizontal value, in design units
	YCoordinate int16 // Vertical value, in design units
	// contains filtered or unexported fields
}

func ParseAnchorFormat1

func ParseAnchorFormat1(src []byte) (AnchorFormat1, int, error)

type AnchorFormat2

type AnchorFormat2 struct {
	XCoordinate int16  // Horizontal value, in design units
	YCoordinate int16  // Vertical value, in design units
	AnchorPoint uint16 // Index to glyph contour point
	// contains filtered or unexported fields
}

func ParseAnchorFormat2

func ParseAnchorFormat2(src []byte) (AnchorFormat2, int, error)

type AnchorFormat3

type AnchorFormat3 struct {
	XCoordinate int16 // Horizontal value, in design units
	YCoordinate int16 // Vertical value, in design units

	XDevice DeviceTable `isOpaque:""` // Offset to Device table (non-variable font) / VariationIndex table (variable font) for X coordinate, from beginning of Anchor table (may be NULL)
	YDevice DeviceTable `isOpaque:""` // Offset to Device table (non-variable font) / VariationIndex table (variable font) for Y coordinate, from beginning of Anchor table (may be NULL)
	// contains filtered or unexported fields
}

func ParseAnchorFormat3

func ParseAnchorFormat3(src []byte) (AnchorFormat3, int, error)

type AnchorMatrix

type AnchorMatrix struct {
	// contains filtered or unexported fields
}

AnchorMatrix is a compact representation of a [][]Anchor

func (AnchorMatrix) Anchor

func (am AnchorMatrix) Anchor(index, class int) Anchor

func (AnchorMatrix) Len

func (am AnchorMatrix) Len() int

type Ankr

type Ankr struct {
	// contains filtered or unexported fields
}

Ankr is the anchor point table See - https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6ankr.html

func ParseAnkr

func ParseAnkr(src []byte, valuesCount int) (Ankr, int, error)

func (Ankr) GetAnchor

func (ank Ankr) GetAnchor(glyph GlyphID, index int) (anchor AnkrAnchor)

GetAnchor return the i-th anchor for `glyph`, or {0,0} if not found.

type AnkrAnchor

type AnkrAnchor struct {
	X, Y int16
}

AnkrAnchor is a point within the coordinate space of a given glyph independent of the control points used to render the glyph

func ParseAnkrAnchor

func ParseAnkrAnchor(src []byte) (AnkrAnchor, int, error)

type AttachList

type AttachList struct {
	Coverage     Coverage      `offsetSize:"Offset16"`                            // Offset to Coverage table - from beginning of AttachList table
	AttachPoints []AttachPoint `arrayCount:"FirstUint16" offsetsArray:"Offset16"` // [glyphCount] Array of offsets to AttachPoint tables-from beginning of AttachList table-in Coverage Index order
}

func ParseAttachList

func ParseAttachList(src []byte) (AttachList, int, error)

type AttachPoint

type AttachPoint struct {
	PointIndices []uint16 `arrayCount:"FirstUint16"` // [pointCount]	Array of contour point indices -in increasing numerical order
}

func ParseAttachPoint

func ParseAttachPoint(src []byte) (AttachPoint, int, error)

type Avar

type Avar struct {
	AxisSegmentMaps []SegmentMaps `arrayCount:"FirstUint16"` //[axisCount]	The segment maps array — one segment map for each axis, in the order of axes specified in the 'fvar' table.
	// contains filtered or unexported fields
}

avar — Axis Variations Table

func ParseAvar

func ParseAvar(src []byte) (Avar, int, error)

type AxisValueMap

type AxisValueMap struct {
	FromCoordinate Coord // A normalized coordinate value obtained using default normalization.
	ToCoordinate   Coord // The modified, normalized coordinate value.
}

type BaseArray

type BaseArray struct {
	// contains filtered or unexported fields
}

func ParseBaseArray

func ParseBaseArray(src []byte, offsetsCount int) (BaseArray, int, error)

func (BaseArray) Anchors

func (ba BaseArray) Anchors() AnchorMatrix

type BigGlyphMetrics

type BigGlyphMetrics struct {
	SmallGlyphMetrics
	// contains filtered or unexported fields
}

type BitmapData17

type BitmapData17 struct {
	SmallGlyphMetrics
	Image []byte `arrayCount:"FirstUint32"`
}

Format 17: small metrics, PNG image data

func ParseBitmapData17

func ParseBitmapData17(src []byte) (BitmapData17, int, error)

type BitmapData18

type BitmapData18 struct {
	BigGlyphMetrics
	Image []byte `arrayCount:"FirstUint32"`
}

Format 18: big metrics, PNG image data

func ParseBitmapData18

func ParseBitmapData18(src []byte) (BitmapData18, int, error)

type BitmapData19

type BitmapData19 struct {
	Image []byte `arrayCount:"FirstUint32"`
}

Format 19: metrics in CBLC table, PNG image data

func ParseBitmapData19

func ParseBitmapData19(src []byte) (BitmapData19, int, error)

type BitmapData2

type BitmapData2 struct {
	SmallGlyphMetrics
	Image []byte `arrayCount:"ToEnd"`
}

Format 2: small metrics, bit-aligned data

func ParseBitmapData2

func ParseBitmapData2(src []byte) (BitmapData2, int, error)

type BitmapData5

type BitmapData5 struct {
	Image []byte `arrayCount:"ToEnd"`
}

Format 5: metrics in CBLC table, bit-aligned image data only

func ParseBitmapData5

func ParseBitmapData5(src []byte) (BitmapData5, int, error)

type BitmapGlyphData

type BitmapGlyphData struct {
	OriginOffsetX int16  //	The horizontal (x-axis) position of the left edge of the bitmap graphic in relation to the glyph design space origin.
	OriginOffsetY int16  //	The vertical (y-axis) position of the bottom edge of the bitmap graphic in relation to the glyph design space origin.
	GraphicType   Tag    //	Indicates the format of the embedded graphic data: one of 'jpg ', 'png ' or 'tiff', or the special format 'dupe'.
	Data          []byte `arrayCount:"ToEnd"` //	The actual embedded graphic data. The total length is inferred from sequential entries in the glyphDataOffsets array and the fixed size (8 bytes) of the preceding fields.
}

func ParseBitmapGlyphData

func ParseBitmapGlyphData(src []byte) (BitmapGlyphData, int, error)

type BitmapSize

type BitmapSize struct {
	Hori SbitLineMetrics //	Line metrics for text rendered horizontally.
	Vert SbitLineMetrics //	Line metrics for text rendered vertically.

	PpemX uint8 //	Horizontal pixels per em.
	PpemY uint8 //	Vertical pixels per em.
	// contains filtered or unexported fields
}

type BitmapSubtable

type BitmapSubtable struct {
	FirstGlyph GlyphID //	First glyph ID of this range.
	LastGlyph  GlyphID //	Last glyph ID of this range (inclusive).
	IndexSubHeader
}

type Bloc

type Bloc = CBLC

Bloc is the bitmap location table See - https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bloc.html

type CBLC

type CBLC struct {
	BitmapSizes    []BitmapSize       `arrayCount:"FirstUint32"` // BitmapSize records array.
	IndexSubTables [][]BitmapSubtable `isOpaque:""`              // with same length as [BitmapSizes]
	// contains filtered or unexported fields
}

CBLC is the Color Bitmap Location Table See - https://learn.microsoft.com/fr-fr/typography/opentype/spec/cblc

func ParseCBLC

func ParseCBLC(src []byte) (CBLC, int, error)

type CFF

type CFF = []byte

CFF is the Compact Font Format Table. Since it used its own format, quite different from the regular Opentype format, its interpretation is handled externally (see font/cff). See also https://learn.microsoft.com/fr-fr/typography/opentype/spec/cff

type CaretValue

type CaretValue interface {
	// contains filtered or unexported methods
}

func ParseCaretValue

func ParseCaretValue(src []byte) (CaretValue, int, error)

type CaretValue1

type CaretValue1 struct {
	Coordinate int16 //	X or Y value, in design units
	// contains filtered or unexported fields
}

func ParseCaretValue1

func ParseCaretValue1(src []byte) (CaretValue1, int, error)

type CaretValue2

type CaretValue2 struct {
	CaretValuePointIndex uint16 // Contour point index on glyph
	// contains filtered or unexported fields
}

func ParseCaretValue2

func ParseCaretValue2(src []byte) (CaretValue2, int, error)

type CaretValue3

type CaretValue3 struct {
	Coordinate int16 // X or Y value, in design units

	Device DeviceTable `isOpaque:""`
	// contains filtered or unexported fields
}

func ParseCaretValue3

func ParseCaretValue3(src []byte) (CaretValue3, int, error)

type ChainedClassSequenceRuleSet

type ChainedClassSequenceRuleSet = ChainedSequenceRuleSet

ChainedClassSequenceRuleSet has the same binary format as ChainedSequenceRuleSet, and using the same type simplifies later processing.

type ChainedContextualPos

type ChainedContextualPos struct {
	Data ChainedContextualPosITF
}

func ParseChainedContextualPos

func ParseChainedContextualPos(src []byte) (ChainedContextualPos, int, error)

func (ChainedContextualPos) Cov

func (lk ChainedContextualPos) Cov() Coverage

type ChainedContextualPos1

type ChainedContextualPos1 ChainedSequenceContextFormat1

func ParseChainedContextualPos1

func ParseChainedContextualPos1(src []byte) (ChainedContextualPos1, int, error)

func (ChainedContextualPos1) Cov

type ChainedContextualPos2

type ChainedContextualPos2 ChainedSequenceContextFormat2

func ParseChainedContextualPos2

func ParseChainedContextualPos2(src []byte) (ChainedContextualPos2, int, error)

func (ChainedContextualPos2) Cov

type ChainedContextualPos3

type ChainedContextualPos3 ChainedSequenceContextFormat3

func ParseChainedContextualPos3

func ParseChainedContextualPos3(src []byte) (ChainedContextualPos3, int, error)

func (ChainedContextualPos3) Cov

type ChainedContextualPosITF

type ChainedContextualPosITF interface {
	Cov() Coverage
	// contains filtered or unexported methods
}

func ParseChainedContextualPosITF

func ParseChainedContextualPosITF(src []byte) (ChainedContextualPosITF, int, error)

type ChainedContextualSubs

type ChainedContextualSubs struct {
	Data ChainedContextualSubsITF
}

func ParseChainedContextualSubs

func ParseChainedContextualSubs(src []byte) (ChainedContextualSubs, int, error)

func (ChainedContextualSubs) Cov

type ChainedContextualSubs1

type ChainedContextualSubs1 ChainedSequenceContextFormat1

func ParseChainedContextualSubs1

func ParseChainedContextualSubs1(src []byte) (ChainedContextualSubs1, int, error)

func (ChainedContextualSubs1) Cov

type ChainedContextualSubs2

type ChainedContextualSubs2 ChainedSequenceContextFormat2

func ParseChainedContextualSubs2

func ParseChainedContextualSubs2(src []byte) (ChainedContextualSubs2, int, error)

func (ChainedContextualSubs2) Cov

type ChainedContextualSubs3

type ChainedContextualSubs3 ChainedSequenceContextFormat3

func ParseChainedContextualSubs3

func ParseChainedContextualSubs3(src []byte) (ChainedContextualSubs3, int, error)

func (ChainedContextualSubs3) Cov

type ChainedContextualSubsITF

type ChainedContextualSubsITF interface {
	Cov() Coverage
	// contains filtered or unexported methods
}

func ParseChainedContextualSubsITF

func ParseChainedContextualSubsITF(src []byte) (ChainedContextualSubsITF, int, error)

type ChainedSequenceContextFormat1

type ChainedSequenceContextFormat1 struct {
	ChainedSeqRuleSet []ChainedSequenceRuleSet `arrayCount:"FirstUint16"  offsetsArray:"Offset16"` //[chainedSeqRuleSetCount]	Array of offsets to ChainedSeqRuleSet tables, from beginning of ChainedSequenceContextFormat1 table (may be NULL)
	// contains filtered or unexported fields
}

type ChainedSequenceContextFormat2

type ChainedSequenceContextFormat2 struct {
	BacktrackClassDef      ClassDef                      `offsetSize:"Offset16"`                            // Offset to ClassDef table containing backtrack sequence context, from beginning of ChainedSequenceContextFormat2 table
	InputClassDef          ClassDef                      `offsetSize:"Offset16"`                            // Offset to ClassDef table containing input sequence context, from beginning of ChainedSequenceContextFormat2 table
	LookaheadClassDef      ClassDef                      `offsetSize:"Offset16"`                            // Offset to ClassDef table containing lookahead sequence context, from beginning of ChainedSequenceContextFormat2 table
	ChainedClassSeqRuleSet []ChainedClassSequenceRuleSet `arrayCount:"FirstUint16" offsetsArray:"Offset16"` //[chainedClassSeqRuleSetCount]	Array of offsets to ChainedClassSequenceRuleSet tables, from beginning of ChainedSequenceContextFormat2 table (may be NULL)
	// contains filtered or unexported fields
}

type ChainedSequenceContextFormat3

type ChainedSequenceContextFormat3 struct {
	BacktrackCoverages []Coverage             `arrayCount:"FirstUint16" offsetsArray:"Offset16"` //[backtrackGlyphCount]	Array of offsets to coverage tables for the backtrack sequence
	InputCoverages     []Coverage             `arrayCount:"FirstUint16" offsetsArray:"Offset16"` //[inputGlyphCount]	Array of offsets to coverage tables for the input sequence
	LookaheadCoverages []Coverage             `arrayCount:"FirstUint16" offsetsArray:"Offset16"` //[lookaheadGlyphCount]	Array of offsets to coverage tables for the lookahead sequence
	SeqLookupRecords   []SequenceLookupRecord `arrayCount:"FirstUint16"`                         //[seqLookupCount]	Array of SequenceLookupRecords
	// contains filtered or unexported fields
}

type ChainedSequenceRule

type ChainedSequenceRule struct {
	BacktrackSequence []GlyphID `arrayCount:"FirstUint16"` //[backtrackGlyphCount]	Array of backtrack glyph IDs

	InputSequence     []GlyphID              `arrayCount:"ComputedField-inputGlyphCount-1"` //[inputGlyphCount - 1]	Array of input glyph IDs—start with second glyph
	LookaheadSequence []GlyphID              `arrayCount:"FirstUint16"`                     //[lookaheadGlyphCount]	Array of lookahead glyph IDs
	SeqLookupRecords  []SequenceLookupRecord `arrayCount:"FirstUint16"`                     //[seqLookupCount]	Array of SequenceLookupRecords
	// contains filtered or unexported fields
}

func ParseChainedSequenceRule

func ParseChainedSequenceRule(src []byte) (ChainedSequenceRule, int, error)

type ChainedSequenceRuleSet

type ChainedSequenceRuleSet struct {
	ChainedSeqRules []ChainedSequenceRule `arrayCount:"FirstUint16" offsetsArray:"Offset16"` // Array of offsets to SequenceRule tables, from beginning of the SequenceRuleSet table
}

func ParseChainedSequenceRuleSet

func ParseChainedSequenceRuleSet(src []byte) (ChainedSequenceRuleSet, int, error)

type Class1Record

type Class1Record []Class2Record //[class2Count]	Array of Class2 records, ordered by classes in classDef2.

type Class2Record

type Class2Record struct {
	ValueRecord1 ValueRecord //	Positioning for first glyph — empty if valueFormat1 = 0.
	ValueRecord2 ValueRecord //	Positioning for second glyph — empty if valueFormat2 = 0.
}

type ClassDef

type ClassDef interface {
	Class(gi GlyphID) (uint16, bool)

	// Extent returns the maximum class ID + 1. This is the length
	// required for an array to be indexed by the class values.
	Extent() int
	// contains filtered or unexported methods
}

ClassDef stores a value for a set of GlyphIDs. Conceptually it is a map[GlyphID]uint16, but it may be implemented more efficiently.

func ParseClassDef

func ParseClassDef(src []byte) (ClassDef, int, error)

type ClassDef1

type ClassDef1 struct {
	StartGlyphID    GlyphID  // First glyph ID of the classValueArray
	ClassValueArray []uint16 `arrayCount:"FirstUint16"` //[glyphCount]	Array of Class Values — one per glyph ID
	// contains filtered or unexported fields
}

func ParseClassDef1

func ParseClassDef1(src []byte) (ClassDef1, int, error)

func (ClassDef1) Class

func (cl ClassDef1) Class(gi GlyphID) (uint16, bool)

func (ClassDef1) Extent

func (cl ClassDef1) Extent() int

type ClassDef2

type ClassDef2 struct {
	ClassRangeRecords []ClassRangeRecord `arrayCount:"FirstUint16"` //[glyphCount]	Array of Class Values — one per glyph ID
	// contains filtered or unexported fields
}

func ParseClassDef2

func ParseClassDef2(src []byte) (ClassDef2, int, error)

func (ClassDef2) Class

func (cl ClassDef2) Class(g GlyphID) (uint16, bool)

func (ClassDef2) Extent

func (cl ClassDef2) Extent() int

type ClassRangeRecord

type ClassRangeRecord struct {
	StartGlyphID GlyphID // First glyph ID in the range
	EndGlyphID   GlyphID // Last glyph ID in the range
	Class        uint16  // Applied to all glyphs in the range
}

type ClassSequenceRuleSet

type ClassSequenceRuleSet = SequenceRuleSet

ClassSequenceRuleSet has the same binary format as SequenceRuleSet, and using the same type simplifies later processing.

type ClassTable

type ClassTable struct {
	StartGlyph GlyphID
	Values     []byte `arrayCount:"FirstUint16"`
}

ClassTable is the same as AATLookup8, but with no format and with bytes instead of uint16s

func ParseClassTable

func ParseClassTable(src []byte) (ClassTable, int, error)

type Cmap

type Cmap struct {
	Records []EncodingRecord `arrayCount:"ComputedField-numTables"`
	// contains filtered or unexported fields
}

Cmap is the Character to Glyph Index Mapping table See https://learn.microsoft.com/en-us/typography/opentype/spec/cmap

func ParseCmap

func ParseCmap(src []byte) (Cmap, int, error)

type CmapSubtable

type CmapSubtable interface {
	// contains filtered or unexported methods
}

CmapSubtable is the union type for the various cmap formats

func ParseCmapSubtable

func ParseCmapSubtable(src []byte) (CmapSubtable, int, error)

type CmapSubtable0

type CmapSubtable0 struct {
	GlyphIdArray [256]uint8 //	An array that maps character codes to glyph index values.
	// contains filtered or unexported fields
}

func ParseCmapSubtable0

func ParseCmapSubtable0(src []byte) (CmapSubtable0, int, error)

type CmapSubtable10

type CmapSubtable10 struct {
	StartCharCode uint32    // First character code covered
	GlyphIdArray  []GlyphID `arrayCount:"FirstUint32"` // Array of glyph indices for the character codes covered
	// contains filtered or unexported fields
}

func ParseCmapSubtable10

func ParseCmapSubtable10(src []byte) (CmapSubtable10, int, error)

type CmapSubtable12

type CmapSubtable12 struct {
	Groups []SequentialMapGroup `arrayCount:"FirstUint32"` // Array of SequentialMapGroup records.
	// contains filtered or unexported fields
}

func ParseCmapSubtable12

func ParseCmapSubtable12(src []byte) (CmapSubtable12, int, error)

type CmapSubtable13

type CmapSubtable13 struct {
	Groups []SequentialMapGroup `arrayCount:"FirstUint32"` // Array of SequentialMapGroup records.
	// contains filtered or unexported fields
}

func ParseCmapSubtable13

func ParseCmapSubtable13(src []byte) (CmapSubtable13, int, error)

type CmapSubtable14

type CmapSubtable14 struct {
	VarSelectors []VariationSelector `arrayCount:"FirstUint32"` // [numVarSelectorRecords]	Array of VariationSelector records.
	// contains filtered or unexported fields
}

func ParseCmapSubtable14

func ParseCmapSubtable14(src []byte) (CmapSubtable14, int, error)

type CmapSubtable2

type CmapSubtable2 struct {
	// contains filtered or unexported fields
}

func ParseCmapSubtable2

func ParseCmapSubtable2(src []byte) (CmapSubtable2, int, error)

type CmapSubtable4

type CmapSubtable4 struct {
	EndCode []uint16 `arrayCount:"ComputedField-segCountX2 / 2"` // [segCount]uint16 End characterCode for each segment, last=0xFFFF.

	StartCode      []uint16 `arrayCount:"ComputedField-segCountX2 / 2"` // [segCount]uint16 Start character code for each segment.
	IdDelta        []uint16 `arrayCount:"ComputedField-segCountX2 / 2"` // [segCount]int16 Delta for all character codes in segment.
	IdRangeOffsets []uint16 `arrayCount:"ComputedField-segCountX2 / 2"` // [segCount]uint16 Offsets into glyphIdArray or 0
	GlyphIDArray   []byte   `arrayCount:"ToEnd"`                        // glyphIdArray : uint16[] glyph index array (arbitrary length)
	// contains filtered or unexported fields
}

func ParseCmapSubtable4

func ParseCmapSubtable4(src []byte) (CmapSubtable4, int, error)

type CmapSubtable6

type CmapSubtable6 struct {
	FirstCode    uint16    // First character code of subrange.
	GlyphIdArray []GlyphID `arrayCount:"FirstUint16"` // Array of glyph index values for character codes in the range.
	// contains filtered or unexported fields
}

func ParseCmapSubtable6

func ParseCmapSubtable6(src []byte) (CmapSubtable6, int, error)

type CompositeGlyph

type CompositeGlyph struct {
	Glyphs       []CompositeGlyphPart `isOpaque:""`
	Instructions []byte               `isOpaque:""`
}

func ParseCompositeGlyph

func ParseCompositeGlyph(src []byte) (CompositeGlyph, int, error)

type CompositeGlyphPart

type CompositeGlyphPart struct {
	Flags      uint16
	GlyphIndex GlyphID

	// Scale is a matrix x, 01, 10, y ; default to identity
	Scale [4]float32
	// contains filtered or unexported fields
}

func ParseCompositeGlyphPart

func ParseCompositeGlyphPart(src []byte) (CompositeGlyphPart, int, error)

func (*CompositeGlyphPart) ArgsAsIndices

func (c *CompositeGlyphPart) ArgsAsIndices() (int, int)

func (*CompositeGlyphPart) ArgsAsTranslation

func (c *CompositeGlyphPart) ArgsAsTranslation() (int16, int16)

func (*CompositeGlyphPart) HasUseMyMetrics

func (c *CompositeGlyphPart) HasUseMyMetrics() bool

func (*CompositeGlyphPart) IsAnchored

func (c *CompositeGlyphPart) IsAnchored() bool

return true if arg1 and arg2 indicated an anchor point, not offsets

func (*CompositeGlyphPart) IsScaledOffsets

func (c *CompositeGlyphPart) IsScaledOffsets() bool

type ConditionFormat1

type ConditionFormat1 struct {
	AxisIndex           uint16 // Index (zero-based) for the variation axis within the 'fvar' table.
	FilterRangeMinValue Coord  // Minimum value of the font variation instances that satisfy this condition.
	FilterRangeMaxValue Coord  // Maximum value of the font variation instances that satisfy this condition.
	// contains filtered or unexported fields
}

func ParseConditionFormat1

func ParseConditionFormat1(src []byte) (ConditionFormat1, int, error)

type ConditionSet

type ConditionSet struct {
	// uint16	conditionCount	Number of Conditions for this condition set.
	Conditions []ConditionFormat1 `arrayCount:"FirstUint16" offsetsArray:"Offset32"` // [conditionCount]	Array of offsets to condition tables, from beginning of the ConditionSet table.
}

func ParseConditionSet

func ParseConditionSet(src []byte) (ConditionSet, int, error)

type ContextualPos

type ContextualPos struct {
	Data ContextualPosITF
}

func ParseContextualPos

func ParseContextualPos(src []byte) (ContextualPos, int, error)

func (ContextualPos) Cov

func (lk ContextualPos) Cov() Coverage

func (*ContextualPos) Sanitize

func (cs *ContextualPos) Sanitize(lookupCount uint16) error

type ContextualPos1

type ContextualPos1 SequenceContextFormat1

func ParseContextualPos1

func ParseContextualPos1(src []byte) (ContextualPos1, int, error)

func (ContextualPos1) Cov

func (cs ContextualPos1) Cov() Coverage

type ContextualPos2

type ContextualPos2 SequenceContextFormat2

func ParseContextualPos2

func ParseContextualPos2(src []byte) (ContextualPos2, int, error)

func (ContextualPos2) Cov

func (cs ContextualPos2) Cov() Coverage

type ContextualPos3

type ContextualPos3 SequenceContextFormat3

func ParseContextualPos3

func ParseContextualPos3(src []byte) (ContextualPos3, int, error)

func (ContextualPos3) Cov

func (cs ContextualPos3) Cov() Coverage

type ContextualPosITF

type ContextualPosITF interface {
	Cov() Coverage
	// contains filtered or unexported methods
}

func ParseContextualPosITF

func ParseContextualPosITF(src []byte) (ContextualPosITF, int, error)

type ContextualSubs

type ContextualSubs struct {
	Data ContextualSubsITF
}

func ParseContextualSubs

func ParseContextualSubs(src []byte) (ContextualSubs, int, error)

func (ContextualSubs) Cov

func (lk ContextualSubs) Cov() Coverage

func (ContextualSubs) Sanitize

func (cs ContextualSubs) Sanitize(lookupCount uint16) error

type ContextualSubs1

type ContextualSubs1 SequenceContextFormat1

func ParseContextualSubs1

func ParseContextualSubs1(src []byte) (ContextualSubs1, int, error)

func (ContextualSubs1) Cov

func (cs ContextualSubs1) Cov() Coverage

type ContextualSubs2

type ContextualSubs2 SequenceContextFormat2

func ParseContextualSubs2

func ParseContextualSubs2(src []byte) (ContextualSubs2, int, error)

func (ContextualSubs2) Cov

func (cs ContextualSubs2) Cov() Coverage

type ContextualSubs3

type ContextualSubs3 SequenceContextFormat3

func ParseContextualSubs3

func ParseContextualSubs3(src []byte) (ContextualSubs3, int, error)

func (ContextualSubs3) Cov

func (cs ContextualSubs3) Cov() Coverage

type ContextualSubsITF

type ContextualSubsITF interface {
	Cov() Coverage
	// contains filtered or unexported methods
}

func ParseContextualSubsITF

func ParseContextualSubsITF(src []byte) (ContextualSubsITF, int, error)

type Coord

type Coord int16

Coord is real number in [-1;1], stored as a fixed 2.14 integer

func NewCoord

func NewCoord(c float64) Coord

type Coverage

type Coverage interface {

	// Index returns the index of the provided glyph, or
	// `false` if the glyph is not covered by this lookup.
	// Note: this method is injective: two distincts, covered glyphs are mapped
	// to distincts indices.
	Index(GlyphID) (int, bool)

	// Len return the number of glyphs covered.
	// It is 0 for empty coverages.
	// For non empty Coverages, it is also 1 + (maximum index returned)
	Len() int
	// contains filtered or unexported methods
}

Coverage specifies all the glyphs affected by a substitution or positioning operation described in a subtable. Conceptually is it a []GlyphIndex, with an Index method, but it may be implemented for efficiently. See https://learn.microsoft.com/typography/opentype/spec/chapter2#lookup-table

func ParseCoverage

func ParseCoverage(src []byte) (Coverage, int, error)

type Coverage1

type Coverage1 struct {
	Glyphs []GlyphID `arrayCount:"FirstUint16"`
	// contains filtered or unexported fields
}

func ParseCoverage1

func ParseCoverage1(src []byte) (Coverage1, int, error)

func (Coverage1) Index

func (c Coverage1) Index(gi GlyphID) (int, bool)

func (Coverage1) Len

func (cl Coverage1) Len() int

type Coverage2

type Coverage2 struct {
	Ranges []RangeRecord `arrayCount:"FirstUint16"`
	// contains filtered or unexported fields
}

func ParseCoverage2

func ParseCoverage2(src []byte) (Coverage2, int, error)

func (Coverage2) Index

func (c Coverage2) Index(gi GlyphID) (int, bool)

func (Coverage2) Len

func (cr Coverage2) Len() int

type CursivePos

type CursivePos struct {
	EntryExits []EntryExit `isOpaque:""`
	// contains filtered or unexported fields
}

func ParseCursivePos

func ParseCursivePos(src []byte) (CursivePos, int, error)

func (CursivePos) Cov

func (lk CursivePos) Cov() Coverage

type DefaultUVSTable

type DefaultUVSTable struct {
	Ranges []UnicodeRange `arrayCount:"FirstUint32"`
}

DefaultUVSTable is used in Cmap format 14 See https://learn.microsoft.com/en-us/typography/opentype/spec/cmap#default-uvs-table

func ParseDefaultUVSTable

func ParseDefaultUVSTable(src []byte) (DefaultUVSTable, int, error)

type DeltaSetMapping

type DeltaSetMapping struct {

	// uint16 or uint32	mapCount : The number of mapping entries.
	Map []VariationStoreIndex `isOpaque:"" subsliceStart:"AtCurrent"`
	// contains filtered or unexported fields
}

func ParseDeltaSetMapping

func ParseDeltaSetMapping(src []byte) (DeltaSetMapping, int, error)

func (DeltaSetMapping) Index

Index returns the VariationStoreIndex for the given index.

type DeviceHinting

type DeviceHinting struct {
	// with length endSize - startSize + 1
	Values []int8
	// correction range, in ppem
	StartSize, EndSize uint16
}

func (DeviceHinting) GetDelta

func (dev DeviceHinting) GetDelta(ppem uint16, scale int32) int32

GetDelta returns the hint for the given `ppem`, scaled by `scale`. It returns 0 for out of range `ppem` values.

type DeviceTable

type DeviceTable interface {
	// contains filtered or unexported methods
}

DeviceTable is either an DeviceHinting for standard fonts, or a DeviceVariation for variable fonts.

type DeviceTableHeader

type DeviceTableHeader struct {
	// contains filtered or unexported fields
}

DeviceTableHeader is the common header for DeviceTable See https://learn.microsoft.com/fr-fr/typography/opentype/spec/chapter2#device-and-variationindex-tables

func ParseDeviceTableHeader

func ParseDeviceTableHeader(src []byte) (DeviceTableHeader, int, error)

type DeviceVariation

type DeviceVariation VariationStoreIndex

type EBLC

type EBLC = CBLC

EBLC is the Embedded Bitmap Location Table See - https://learn.microsoft.com/fr-fr/typography/opentype/spec/eblc

type EncodingID

type EncodingID uint16

EncodingID represents the platform specific id for entries in the name table. The most common values are provided as constants.

type EncodingRecord

type EncodingRecord struct {
	PlatformID PlatformID   // Platform ID.
	EncodingID EncodingID   // Platform-specific encoding ID.
	Subtable   CmapSubtable `offsetSize:"Offset32" offsetRelativeTo:"Parent"` // Byte offset from beginning of table to the subtable for this encoding.
}

func ParseEncodingRecord

func ParseEncodingRecord(src []byte, parentSrc []byte) (EncodingRecord, int, error)

type EntryExit

type EntryExit struct {
	EntryAnchor Anchor
	ExitAnchor  Anchor
}

func ParseEntryExit

func ParseEntryExit(src []byte) (EntryExit, int, error)

type Extension

type Extension struct {
	ExtensionLookupType uint16   //	Lookup type of subtable referenced by extensionOffset (that is, the extension subtable).
	ExtensionOffset     Offset32 //	Offset to the extension subtable, of lookup type extensionLookupType, relative to the start of the ExtensionSubstFormat1 subtable.
	RawData             []byte   `subsliceStart:"AtStart" arrayCount:"ToEnd"`
	// contains filtered or unexported fields
}

type ExtensionPos

type ExtensionPos Extension

func ParseExtensionPos

func ParseExtensionPos(src []byte) (ExtensionPos, int, error)

func (ExtensionPos) Cov

func (lk ExtensionPos) Cov() Coverage

func (ExtensionPos) Resolve

func (ext ExtensionPos) Resolve() (GPOSLookup, error)

type ExtensionSubs

type ExtensionSubs Extension

func ParseExtensionSubs

func ParseExtensionSubs(src []byte) (ExtensionSubs, int, error)

func (ExtensionSubs) Cov

func (lk ExtensionSubs) Cov() Coverage

func (ExtensionSubs) Resolve

func (ext ExtensionSubs) Resolve() (GSUBLookup, error)

type Feat

type Feat struct {
	Names []FeatureName `arrayCount:"ComputedField-featureNameCount"` //	The feature name array.
	// contains filtered or unexported fields
}

Feat is the feature name table. See - https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6feat.html

func ParseFeat

func ParseFeat(src []byte) (Feat, int, error)

func (Feat) GetFeature

func (ft Feat) GetFeature(feature uint16) *FeatureName

GetFeature performs a binary seach into the names, using `Feature` as key, returning `nil` if not found.

type Feature

type Feature struct {
	LookupListIndices []uint16 `arrayCount:"FirstUint16"` // [lookupIndexCount]	Array of indices into the LookupList — zero-based (first lookup is LookupListIndex = 0)
	// contains filtered or unexported fields
}

func ParseFeature

func ParseFeature(src []byte) (Feature, int, error)

type FeatureList

type FeatureList struct {
	Records  []TagOffsetRecord `arrayCount:"FirstUint16"` // Array of FeatureRecords — zero-based (first feature has FeatureIndex = 0), listed alphabetically by feature tag
	Features []Feature         `isOpaque:""`
}

func ParseFeatureList

func ParseFeatureList(src []byte) (FeatureList, int, error)

type FeatureName

type FeatureName struct {
	Feature uint16 // Feature type.

	SettingTable []FeatureSettingName `offsetSize:"Offset32" offsetRelativeTo:"Parent" arrayCount:"ComputedField-nSettings"` // Offset in bytes from the beginning of the 'feat' table to this feature's setting name array. The actual type of record this offset refers to will depend on the exclusivity value, as described below.
	FeatureFlags uint16               // Single-bit flags associated with the feature type.
	NameIndex    uint16               // The name table index for the feature's name. This index has values greater than 255 and less than 32768.
	// contains filtered or unexported fields
}

func ParseFeatureName

func ParseFeatureName(src []byte, parentSrc []byte) (FeatureName, int, error)

func (*FeatureName) IsExclusive

func (feature *FeatureName) IsExclusive() bool

IsExclusive returns true if the feature settings are mutually exclusive.

type FeatureSettingName

type FeatureSettingName struct {
	Setting   uint16 //	The setting.
	NameIndex uint16 //	The name table index for the setting's name. The nameIndex must be greater than 255 and less than 32768.
}

type FeatureTableSubstitution

type FeatureTableSubstitution struct {
	Substitutions []FeatureTableSubstitutionRecord `arrayCount:"FirstUint16"` // [substitutionCount]	Array of feature table substitution records.
	// contains filtered or unexported fields
}

func ParseFeatureTableSubstitution

func ParseFeatureTableSubstitution(src []byte) (FeatureTableSubstitution, int, error)

type FeatureTableSubstitutionRecord

type FeatureTableSubstitutionRecord struct {
	FeatureIndex     uint16  //	The feature table index to match.
	AlternateFeature Feature `offsetSize:"Offset32" offsetRelativeTo:"Parent"` //	Offset to an alternate feature table, from start of the FeatureTableSubstitution table.
}

func ParseFeatureTableSubstitutionRecord

func ParseFeatureTableSubstitutionRecord(src []byte, parentSrc []byte) (FeatureTableSubstitutionRecord, int, error)

type FeatureVariation

type FeatureVariation struct {
	FeatureVariationRecords []FeatureVariationRecord `arrayCount:"FirstUint32"` //[featureVariationRecordCount]	Array of feature variation records.
	// contains filtered or unexported fields
}

func ParseFeatureVariation

func ParseFeatureVariation(src []byte) (FeatureVariation, int, error)

type FeatureVariationRecord

type FeatureVariationRecord struct {
	ConditionSet  ConditionSet             `offsetSize:"Offset32" offsetRelativeTo:"Parent"` // Offset to a condition set table, from beginning of FeatureVariations table.
	Substitutions FeatureTableSubstitution `offsetSize:"Offset32" offsetRelativeTo:"Parent"` // Offset to a feature table substitution table, from beginning of the FeatureVariations table.
}

func ParseFeatureVariationRecord

func ParseFeatureVariationRecord(src []byte, parentSrc []byte) (FeatureVariationRecord, int, error)

type Float1616

type Float1616 = float32

Float1616 is a float32, represented in fixed 16.16 format in font files.

func Float1616FromUint

func Float1616FromUint(v uint32) Float1616

type FontPage

type FontPage uint16

See https://docs.microsoft.com/en-us/typography/legacy/legacy_arabic_fonts https://github.com/Microsoft/Font-Validator/blob/520aaae/OTFontFileVal/val_OS2.cs#L644-L681

const (
	FPNone       FontPage = 0
	FPHebrew     FontPage = 0xB100 /* Hebrew Windows 3.1 font page */
	FPSimpArabic FontPage = 0xB200 /* Simplified Arabic Windows 3.1 font page */
	FPTradArabic FontPage = 0xB300 /* Traditional Arabic Windows 3.1 font page */
	FPOemArabic  FontPage = 0xB400 /* OEM Arabic Windows 3.1 font page */
	FPSimpFarsi  FontPage = 0xBA00 /* Simplified Farsi Windows 3.1 font page */
	FPTradFarsi  FontPage = 0xBB00 /* Traditional Farsi Windows 3.1 font page */
	FPThai       FontPage = 0xDE00 /* Thai Windows 3.1 font page */
)

type Fvar

type Fvar struct {
	FvarRecords `isOpaque:""`
	// contains filtered or unexported fields
}

Fvar is the Font Variations Table. See - https://learn.microsoft.com/fr-fr/typography/opentype/spec/fvar

func ParseFvar

func ParseFvar(src []byte) (Fvar, int, error)

type FvarRecords

type FvarRecords struct {
	Axis      []VariationAxisRecord
	Instances []InstanceRecord `isOpaque:"" subsliceStart:"AtCurrent"`
}

binarygen: argument=instanceCount int binarygen: argument=instanceSize int

func ParseFvarRecords

func ParseFvarRecords(src []byte, axisCount int, instanceCount int, instanceSize int) (FvarRecords, int, error)

type GDEF

type GDEF struct {
	GlyphClassDef   ClassDef     `offsetSize:"Offset16"` // Offset to class definition table for glyph type, from beginning of GDEF header (may be NULL)
	AttachList      AttachList   `offsetSize:"Offset16"` // Offset to attachment point list table, from beginning of GDEF header (may be NULL)
	LigCaretList    LigCaretList `offsetSize:"Offset16"` // Offset to ligature caret list table, from beginning of GDEF header (may be NULL)
	MarkAttachClass ClassDef     `offsetSize:"Offset16"` // Offset to class definition table for mark attachment type, from beginning of GDEF header (may be NULL)

	MarkGlyphSetsDef MarkGlyphSets `isOpaque:""` // Offset to the table of mark glyph set definitions, from beginning of GDEF header (may be NULL)
	ItemVarStore     ItemVarStore  `isOpaque:""` // Offset to the Item Variation Store table, from beginning of GDEF header (may be NULL)
	// contains filtered or unexported fields
}

func ParseGDEF

func ParseGDEF(src []byte) (GDEF, int, error)

func (*GDEF) GlyphProps

func (gd *GDEF) GlyphProps(glyph GlyphID) GlyphProps

GlyphProps return a summary of the glyph properties.

type GPOS

type GPOS Layout

GPOS is the Glyph Positioning (GPOS) table. It provides precise control over glyph placement for sophisticated text layout and rendering in each script and language system that a font supports. See https://learn.microsoft.com/fr-fr/typography/opentype/spec/gpos

type GPOSLookup

type GPOSLookup interface {

	// Coverage returns the coverage of the lookup subtable.
	// For ContextualPos3 and ChainedContextualPos3, its the coverage of the first input.
	Cov() Coverage
	// contains filtered or unexported methods
}

type GSUB

type GSUB Layout

GSUB is the Glyph Substitution (GSUB) table. It provides data for substition of glyphs for appropriate rendering of scripts, such as cursively-connecting forms in Arabic script, or for advanced typographic effects, such as ligatures. See https://learn.microsoft.com/fr-fr/typography/opentype/spec/gsub

type GSUBLookup

type GSUBLookup interface {

	// Coverage returns the coverage of the lookup subtable.
	// For ContextualSubs3 and ChainedContextualSubs3, its the coverage of the first input.
	Cov() Coverage
	// contains filtered or unexported methods
}

GSUBLookup is one lookup subtable data

type Glyf

type Glyf []Glyph

Glyph Data

func ParseGlyf

func ParseGlyf(src []byte, locaOffsets []uint32) (Glyf, error)

ParseGlyf parses the 'glyf' table. locaOffsets has length numGlyphs + 1, and is returned by ParseLoca

type Glyph

type Glyph struct {
	XMin int16     // Minimum x for coordinate data.
	YMin int16     // Minimum y for coordinate data.
	XMax int16     // Maximum x for coordinate data.
	YMax int16     // Maximum y for coordinate data.
	Data GlyphData `isOpaque:"" subsliceStart:"AtCurrent"`
	// contains filtered or unexported fields
}

func ParseGlyph

func ParseGlyph(src []byte) (Glyph, int, error)

type GlyphContourPoint

type GlyphContourPoint struct {
	Flag uint8
	X, Y int16
}

func ParseGlyphContourPoint

func ParseGlyphContourPoint(src []byte) (GlyphContourPoint, int, error)

type GlyphData

type GlyphData interface {
	// contains filtered or unexported methods
}

type GlyphID

type GlyphID = uint16

type GlyphIdOffsetPair

type GlyphIdOffsetPair struct {
	GlyphID    GlyphID  //	Glyph ID of glyph present.
	SbitOffset Offset16 //	Location in EBDT.
}

type GlyphProps

type GlyphProps = uint16

GlyphProps is a 16-bit integer where the lower 8-bit have bits representing glyph class, and high 8-bit the mark attachment type (if any).

const (
	GPBaseGlyph GlyphProps = 1 << (iota + 1)
	GPLigature
	GPMark
)

type GlyphVariationData

type GlyphVariationData struct {
	SerializedData        []byte                 `offsetSize:"Offset16" arrayCount:"ToEnd"`              // Offset from the start of the GlyphVariationData table to the serialized data
	TupleVariationHeaders []TupleVariationHeader `arrayCount:"ComputedField-tupleVariationCount&0x0FFF"` //[tupleCount]	Array of tuple variation headers.
	// contains filtered or unexported fields
}

func ParseGlyphVariationData

func ParseGlyphVariationData(src []byte, axisCount int) (GlyphVariationData, int, error)

func (*GlyphVariationData) HasSharedPointNumbers

func (gv *GlyphVariationData) HasSharedPointNumbers() bool

HasSharedPointNumbers returns true if the 'sharedPointNumbers' is on.

type Gvar

type Gvar struct {
	SharedTuples `offsetSize:"Offset32" arguments:"sharedTuplesCount=.sharedTupleCount,valuesCount=.axisCount"` // Offset from the start of this table to the shared tuple records.

	GlyphVariationDatas []GlyphVariationData `isOpaque:""`
	// contains filtered or unexported fields
}

See - https://learn.microsoft.com/fr-fr/typography/opentype/spec/gvar

func ParseGvar

func ParseGvar(src []byte) (Gvar, int, error)

type HVAR

type HVAR struct {
	ItemVariationStore  ItemVarStore     `offsetSize:"Offset32"` // Offset in bytes from the start of this table to the item variation store table.
	AdvanceWidthMapping DeltaSetMapping  `offsetSize:"Offset32"` // Offset in bytes from the start of this table to the delta-set index mapping for advance widths (may be NULL).
	LsbMapping          *DeltaSetMapping `offsetSize:"Offset32"` // Offset in bytes from the start of this table to the delta-set index mapping for left side bearings (may be NULL).
	RsbMapping          *DeltaSetMapping `offsetSize:"Offset32"` // Offset in bytes from the start of this table to the delta-set index mapping for right side bearings (may be NULL).
	// contains filtered or unexported fields
}

See - https://learn.microsoft.com/fr-fr/typography/opentype/spec/hvar

func ParseHVAR

func ParseHVAR(src []byte) (HVAR, int, error)
type Head struct {
	UnitsPerEm uint16

	XMin     int16
	YMin     int16
	XMax     int16
	YMax     int16
	MacStyle uint16

	IndexToLocFormat int16
	// contains filtered or unexported fields
}

TableHead contains critical information about the rest of the font. https://learn.microsoft.com/en-us/typography/opentype/spec/head https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6head.html

func ParseHead

func ParseHead(src []byte) (Head, int, error)

func (*Head) Upem

func (head *Head) Upem() uint16

Upem returns a sanitize version of the 'UnitsPerEm' field.

type Hhea

type Hhea struct {
	Ascender             int16
	Descender            int16
	LineGap              int16
	AdvanceMax           uint16
	MinFirstSideBearing  int16
	MinSecondSideBearing int16
	MaxExtent            int16
	CaretSlopeRise       int16
	CaretSlopeRun        int16
	CaretOffset          int16

	NumOfLongMetrics uint16
	// contains filtered or unexported fields
}

https://learn.microsoft.com/en-us/typography/opentype/spec/hhea

func ParseHhea

func ParseHhea(src []byte) (Hhea, int, error)

type Hmtx

type Hmtx struct {
	Metrics []LongHorMetric `arrayCount:""`
	// avances are padded with the last value
	// and side bearings are given
	LeftSideBearings []int16 `arrayCount:""`
}

https://learn.microsoft.com/en-us/typography/opentype/spec/hmtx

func ParseHmtx

func ParseHmtx(src []byte, metricsCount int, leftSideBearingsCount int) (Hmtx, int, error)

func (Hmtx) Advance

func (table Hmtx) Advance(gid GlyphID) int16

func (Hmtx) IsEmpty

func (table Hmtx) IsEmpty() bool

type IndexData

type IndexData interface {
	// contains filtered or unexported methods
}

type IndexData1

type IndexData1 struct {
	// sizeOfArray = (lastGlyph - firstGlyph + 1) + 1 + 1 pad if needed
	// sbitOffsets[glyphIndex] + imageDataOffset = glyphData
	SbitOffsets []Offset32
}

func ParseIndexData1

func ParseIndexData1(src []byte, sbitOffsetsCount int) (IndexData1, int, error)

type IndexData2

type IndexData2 struct {
	ImageSize  uint32          // All the glyphs are of the same size.
	BigMetrics BigGlyphMetrics // All glyphs have the same metrics; glyph data may be compressed, byte-aligned, or bit-aligned.
}

func ParseIndexData2

func ParseIndexData2(src []byte) (IndexData2, int, error)

type IndexData3

type IndexData3 struct {
	// sizeOfArray = (lastGlyph - firstGlyph + 1) + 1 + 1 pad if needed
	// sbitOffets[glyphIndex] + imageDataOffset = glyphData
	SbitOffsets []Offset16
}

func ParseIndexData3

func ParseIndexData3(src []byte, sbitOffsetsCount int) (IndexData3, int, error)

type IndexData4

type IndexData4 struct {
	GlyphArray []GlyphIdOffsetPair `arrayCount:"ComputedField-numGlyphs+1"` //[numGlyphs + 1]	One per glyph.
	// contains filtered or unexported fields
}

func ParseIndexData4

func ParseIndexData4(src []byte) (IndexData4, int, error)

type IndexData5

type IndexData5 struct {
	ImageSize    uint32          //	All glyphs have the same data size.
	BigMetrics   BigGlyphMetrics //	All glyphs have the same metrics.
	GlyphIdArray []GlyphID       `arrayCount:"FirstUint32"` // [numGlyphs] One per glyph, sorted by glyph ID.
}

func ParseIndexData5

func ParseIndexData5(src []byte) (IndexData5, int, error)

type IndexSubHeader

type IndexSubHeader struct {
	ImageFormat     uint16    // Format of EBDT image data.
	ImageDataOffset Offset32  // Offset to image data in EBDT table.
	IndexData       IndexData `unionField:"indexFormat"`
	// contains filtered or unexported fields
}

func ParseIndexSubHeader

func ParseIndexSubHeader(src []byte, sbitOffsetsCount int) (IndexSubHeader, int, error)

type IndexSubTableArray

type IndexSubTableArray struct {
	Subtables []IndexSubTableHeader
}

func ParseIndexSubTableArray

func ParseIndexSubTableArray(src []byte, subtablesCount int) (IndexSubTableArray, int, error)

type IndexSubTableHeader

type IndexSubTableHeader struct {
	FirstGlyph GlyphID //	First glyph ID of this range.
	LastGlyph  GlyphID //	Last glyph ID of this range (inclusive).
	// contains filtered or unexported fields
}

type InstanceRecord

type InstanceRecord struct {
	SubfamilyNameID uint16 // The name ID for entries in the 'name' table that provide subfamily names for this instance.

	Coordinates      []Float1616 // [axisCount] The coordinates array for this instance.
	PostScriptNameID uint16      `isOpaque:"" subsliceStart:"AtCurrent"` // Optional. The name ID for entries in the 'name' table that provide PostScript names for this instance.
	// contains filtered or unexported fields
}

func ParseInstanceRecord

func ParseInstanceRecord(src []byte, coordinatesCount int) (InstanceRecord, int, error)

type ItemVarStore

type ItemVarStore struct {
	VariationRegionList VariationRegionList `offsetSize:"Offset32"`                            // Offset in bytes from the start of the item variation store to the variation region list.
	ItemVariationDatas  []ItemVariationData `arrayCount:"FirstUint16" offsetsArray:"Offset32"` // [itemVariationDataCount] Offsets in bytes from the start of the item variation store to each item variation data subtable.
	// contains filtered or unexported fields
}

func ParseItemVarStore

func ParseItemVarStore(src []byte) (ItemVarStore, int, error)

func (*ItemVarStore) AxisCount

func (vs *ItemVarStore) AxisCount() int

AxisCount returns the number of axis found in the var store, which must be the same as the one in the 'fvar' table. It returns -1 if the store is empty

func (ItemVarStore) GetDelta

func (store ItemVarStore) GetDelta(index VariationStoreIndex, coords []Coord) float32

GetDelta uses the variation [store] and the selected instance coordinates [coords] to compute the value at [index].

type ItemVariationData

type ItemVariationData struct {
	RegionIndexes []uint16  `arrayCount:"ComputedField-regionIndexCount"` //[regionIndexCount]	Array of indices into the variation region list for the regions referenced by this item variation data table.
	DeltaSets     [][]int16 `isOpaque:"" subsliceStart:"AtCurrent"`       //[itemCount]	Delta-set rows.
	// contains filtered or unexported fields
}

func ParseItemVariationData

func ParseItemVariationData(src []byte) (ItemVariationData, int, error)

type KAAnchor

type KAAnchor struct {
	Mark, Current uint16
}

type KAControl

type KAControl struct {
	Mark, Current uint16
}

type KACoordinates

type KACoordinates struct {
	MarkX, MarkY, CurrentX, CurrentY int16
}

type Kern

type Kern struct {
	Tables []KernSubtable
	// contains filtered or unexported fields
}

Kern is the kern table. It has multiple header format, defined in Apple AAT and Microsoft OT specs, but the subtable data actually are the same.

Microsoft (OT) format

version uint16 : Table version number (0)
nTables uint16 : Number of subtables in the kerning table.

Apple (AAT) old format

version uint16 : The version number of the kerning table (0x0001 for the current version).
nTables uint16 : The number of subtables included in the kerning table.

Apple (AAT) new format

version uint32 : The version number of the kerning table (0x00010000 for the current version).
nTables uint32 : The number of subtables included in the kerning table.

See - https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6kern.html and - https://learn.microsoft.com/fr-fr/typography/opentype/spec/kern

func ParseKern

func ParseKern(src []byte) (Kern, int, error)

We apply the following logic:

  • read the first uint16 -> it's always the major version
  • if it's 0, we have a Miscrosoft table
  • if it's 1, we have an Apple table. We read the next uint16, to differentiate between the old and the new Apple format.

type KernData

type KernData interface {
	// contains filtered or unexported methods
}

type KernData0

type KernData0 struct {
	Pairs []Kernx0Record `arrayCount:"ComputedField-nPairs"`
	// contains filtered or unexported fields
}

func ParseKernData0

func ParseKernData0(src []byte) (KernData0, int, error)

type KernData1

type KernData1 struct {
	AATStateTable

	Values []int16 `isOpaque:""`
	// contains filtered or unexported fields
}

func ParseKernData1

func ParseKernData1(src []byte) (KernData1, int, error)

type KernData2

type KernData2 struct {
	Left         AATLoopkup8Data `offsetSize:"Offset16" offsetRelativeTo:"Parent"`
	Right        AATLoopkup8Data `offsetSize:"Offset16" offsetRelativeTo:"Parent"`
	KerningStart Offset16        // Offset from beginning of this subtable to the start of the kerning array.
	KerningData  []byte          `isOpaque:"" offsetRelativeTo:"Parent"` // indexed by Left + Right
	// contains filtered or unexported fields
}

func ParseKernData2

func ParseKernData2(src []byte, parentSrc []byte) (KernData2, int, error)

type KernData3

type KernData3 struct {
	RightClassCount uint8 // The number of right-hand classes.

	Kernings   []int16 `arrayCount:"ComputedField-kernValueCount"`
	LeftClass  []uint8 `arrayCount:"ComputedField-glyphCount"`
	RightClass []uint8 `arrayCount:"ComputedField-glyphCount"`
	KernIndex  []uint8 `arrayCount:"ComputedField-nKernIndex()"`
	// contains filtered or unexported fields
}

func ParseKernData3

func ParseKernData3(src []byte) (KernData3, int, error)

type KernSubtable

type KernSubtable interface {
	// Data returns the actual kerning data
	Data() KernData
}

type Kernx0Record

type Kernx0Record struct {
	Left, Right GlyphID
	Value       int16
}

type Kerx

type Kerx struct {
	Tables []KerxSubtable `arrayCount:"ComputedField-nTables"`
	// contains filtered or unexported fields
}

Kerx is the extended kerning table See https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6kerx.html

func ParseKerx

func ParseKerx(src []byte, valuesCount int) (Kerx, int, error)

type KerxAnchorAnchors

type KerxAnchorAnchors struct {
	Anchors []KAAnchor
}

func ParseKerxAnchorAnchors

func ParseKerxAnchorAnchors(src []byte, anchorsCount int) (KerxAnchorAnchors, int, error)

type KerxAnchorControls

type KerxAnchorControls struct {
	Anchors []KAControl
}

func ParseKerxAnchorControls

func ParseKerxAnchorControls(src []byte, anchorsCount int) (KerxAnchorControls, int, error)

type KerxAnchorCoordinates

type KerxAnchorCoordinates struct {
	Anchors []KACoordinates
}

func ParseKerxAnchorCoordinates

func ParseKerxAnchorCoordinates(src []byte, anchorsCount int) (KerxAnchorCoordinates, int, error)

type KerxAnchors

type KerxAnchors interface {
	// contains filtered or unexported methods
}

type KerxData

type KerxData interface {
	// contains filtered or unexported methods
}

type KerxData0

type KerxData0 struct {
	Pairs []Kernx0Record `arrayCount:"ComputedField-nPairs"`
	// contains filtered or unexported fields
}

binarygen: argument=tupleCount int

func ParseKerxData0

func ParseKerxData0(src []byte, tupleCount int) (KerxData0, int, error)

type KerxData1

type KerxData1 struct {
	AATStateTableExt `arguments:"valuesCount=valuesCount, entryDataSize=2"`

	Values []int16 `isOpaque:""`
	// contains filtered or unexported fields
}

binarygen: argument=tupleCount int binarygen: argument=valuesCount int

func ParseKerxData1

func ParseKerxData1(src []byte, tupleCount int, valuesCount int) (KerxData1, int, error)

type KerxData2

type KerxData2 struct {
	Left         AATLookup `offsetSize:"Offset32" offsetRelativeTo:"Parent"` // Offset from beginning of this subtable to the left-hand offset table.
	Right        AATLookup `offsetSize:"Offset32" offsetRelativeTo:"Parent"` // Offset from beginning of this subtable to right-hand offset table.
	KerningStart Offset32  // Offset from beginning of this subtable to the start of the kerning array.
	KerningData  []byte    `subsliceStart:"AtStart" arrayCount:"ToEnd"` // indexed by Left + Right
	// contains filtered or unexported fields
}

func ParseKerxData2

func ParseKerxData2(src []byte, parentSrc []byte, valuesCount int) (KerxData2, int, error)

type KerxData4

type KerxData4 struct {
	AATStateTableExt `arguments:"valuesCount=valuesCount,entryDataSize=2"`
	Flags            uint32
	Anchors          KerxAnchors `isOpaque:""`
}

binarygen: argument=valuesCount int

func ParseKerxData4

func ParseKerxData4(src []byte, valuesCount int) (KerxData4, int, error)

func (KerxData4) ActionType

func (kd KerxData4) ActionType() uint8

ActionType returns 0, 1 or 2, according to the anchor format :

  • 0 : KerxAnchorControls
  • 1 : KerxAnchorAnchors
  • 2 : KerxAnchorCoordinates

type KerxData6

type KerxData6 struct {
	Row    AatLookupMixed `isOpaque:"" offsetRelativeTo:"Parent"` // Values are pre-multiplied by `columnCount`
	Column AatLookupMixed `isOpaque:"" offsetRelativeTo:"Parent"`
	// with rowCount * columnCount
	// for tuples the values are estParseKerx (Not yet run).the first element of the tuple
	Kernings []int16 `isOpaque:""  offsetRelativeTo:"Parent"`
	// contains filtered or unexported fields
}

binarygen: argument=tupleCount int binarygen: argument=valuesCount int

func ParseKerxData6

func ParseKerxData6(src []byte, parentSrc []byte, tupleCount int, valuesCount int) (KerxData6, int, error)

type KerxSubtable

type KerxSubtable struct {
	Coverage uint16 // Circumstances under which this table is used.

	TupleCount uint32   // The tuple count. This value is only used with variation fonts and should be 0 for all other fonts. The subtable's tupleCount will be ignored if the 'kerx' table version is less than 4.
	Data       KerxData `unionField:"version" arguments:"tupleCount=.TupleCount, valuesCount=valuesCount"`
	// contains filtered or unexported fields
}

binarygen: argument=valuesCount int

func ParseKerxSubtable

func ParseKerxSubtable(src []byte, valuesCount int) (KerxSubtable, int, error)

type LangSys

type LangSys struct {
	RequiredFeatureIndex uint16   // Index of a feature required for this language system; if no required features = 0xFFFF
	FeatureIndices       []uint16 `arrayCount:"FirstUint16"` // [featureIndexCount]	Array of indices into the FeatureList, in arbitrary order
	// contains filtered or unexported fields
}

func ParseLangSys

func ParseLangSys(src []byte) (LangSys, int, error)

type LanguageID

type LanguageID uint16

LanguageID represents the language used by an entry in the name table

type Layout

type Layout struct {
	ScriptList        ScriptList        `offsetSize:"Offset16"` // Offset to ScriptList table, from beginning of GPOS table
	FeatureList       FeatureList       `offsetSize:"Offset16"` // Offset to FeatureList table, from beginning of GPOS table
	LookupList        lookupList        `offsetSize:"Offset16"` // Offset to LookupList table, from beginning of GPOS table
	FeatureVariations *FeatureVariation `isOpaque:""`           // Offset to FeatureVariations table, from beginning of GPOS table (may be NULL)
	// contains filtered or unexported fields
}

Layout represents the common layout table used by GPOS and GSUB. The Features field contains all the features for this layout. However, the script and language determines which feature is used.

See https://learn.microsoft.com/typography/opentype/spec/chapter2#organization See https://learn.microsoft.com/typography/opentype/spec/gpos See https://www.microsoft.com/typography/otspec/GSUB.htm

func ParseLayout

func ParseLayout(src []byte) (Layout, int, error)

type LigCaretList

type LigCaretList struct {
	Coverage  Coverage   `offsetSize:"Offset16"`                            // Offset to Coverage table - from beginning of LigCaretList table
	LigGlyphs []LigGlyph `arrayCount:"FirstUint16" offsetsArray:"Offset16"` // [ligGlyphCount]	Array of offsets to LigGlyph tables, from beginning of LigCaretList table —in Coverage Index order
}

func ParseLigCaretList

func ParseLigCaretList(src []byte) (LigCaretList, int, error)

type LigGlyph

type LigGlyph struct {
	CaretValues []CaretValue `arrayCount:"FirstUint16" offsetsArray:"Offset16"` // [caretCount] Array of offsets to CaretValue tables, from beginning of LigGlyph table — in increasing coordinate order
}

func ParseLigGlyph

func ParseLigGlyph(src []byte) (LigGlyph, int, error)

type Ligature

type Ligature struct {
	LigatureGlyph GlyphID //	glyph ID of ligature to substitute

	ComponentGlyphIDs []GlyphID `arrayCount:"ComputedField-componentCount-1"` //  [componentCount - 1]	Array of component glyph IDs — start with the second component, ordered in writing direction
	// contains filtered or unexported fields
}

Glyph components for one ligature

func ParseLigature

func ParseLigature(src []byte) (Ligature, int, error)

type LigatureArray

type LigatureArray struct {
	LigatureAttachs []LigatureAttach `arrayCount:"FirstUint16" offsetsArray:"Offset16"` // [ligatureCount]	Array of offsets to LigatureAttach tables. Offsets are from beginning of LigatureArray table, ordered by ligatureCoverage index.
}

func ParseLigatureArray

func ParseLigatureArray(src []byte, offsetsCount int) (LigatureArray, int, error)

type LigatureAttach

type LigatureAttach struct {
	// contains filtered or unexported fields
}

func ParseLigatureAttach

func ParseLigatureAttach(src []byte, offsetsCount int) (LigatureAttach, int, error)

func (LigatureAttach) Anchors

func (la LigatureAttach) Anchors() AnchorMatrix

type LigatureSet

type LigatureSet struct {
	Ligatures []Ligature `arrayCount:"FirstUint16"  offsetsArray:"Offset16"` // [LigatureCount]	Array of offsets to Ligature tables. Offsets are from beginning of LigatureSet table, ordered by preference.
}

All ligatures beginning with the same glyph

func ParseLigatureSet

func ParseLigatureSet(src []byte) (LigatureSet, int, error)

type LigatureSubs

type LigatureSubs struct {
	Coverage     Coverage      `offsetSize:"Offset16"`                             // Offset to Coverage table, from beginning of substitution subtable
	LigatureSets []LigatureSet `arrayCount:"FirstUint16"  offsetsArray:"Offset16"` //[ligatureSetCount]	Array of offsets to LigatureSet tables. Offsets are from beginning of substitution subtable, ordered by Coverage index
	// contains filtered or unexported fields
}

func ParseLigatureSubs

func ParseLigatureSubs(src []byte) (LigatureSubs, int, error)

func (LigatureSubs) Cov

func (lk LigatureSubs) Cov() Coverage

func (LigatureSubs) Sanitize

func (ls LigatureSubs) Sanitize() error

type LongHorMetric

type LongHorMetric struct {
	AdvanceWidth, LeftSideBearing int16
}

type Lookup

type Lookup struct {
	LookupFlag uint16 // Lookup qualifiers

	MarkFilteringSet uint16 // Index (base 0) into GDEF mark glyph sets structure. This field is only present if the USE_MARK_FILTERING_SET lookup flag is set.
	// contains filtered or unexported fields
}

Lookup is the common format for GSUB and GPOS lookups

func ParseLookup

func ParseLookup(src []byte) (Lookup, int, error)

func (Lookup) AsGPOSLookups

func (lk Lookup) AsGPOSLookups() ([]GPOSLookup, error)

AsGPOSLookups returns the GPOS lookup subtables

func (Lookup) AsGSUBLookups

func (lk Lookup) AsGSUBLookups() ([]GSUBLookup, error)

AsGSUBLookups returns the GSUB lookup subtables.

type LookupRecord2

type LookupRecord2 struct {
	LastGlyph  GlyphID
	FirstGlyph GlyphID
	Value      uint16
}

type Ltag

type Ltag struct {
	// contains filtered or unexported fields
}

Ltag is the language tags table See https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6ltag.html

func ParseLtag

func ParseLtag(src []byte) (Ltag, int, error)

func (Ltag) Language

func (lt Ltag) Language(i uint16) language.Language

type MVAR

type MVAR struct {
	ItemVariationStore ItemVarStore     `offsetSize:"Offset16"`                 // Offset in bytes from the start of this table to the item variation store table. If valueRecordCount is zero, set to zero; if valueRecordCount is greater than zero, must be greater than zero.
	ValueRecords       []VarValueRecord `isOpaque:"" subsliceStart:"AtCurrent"` // [valueRecordCount]	Array of value records that identify target items and the associated delta-set index for each. The valueTag records must be in binary order of their valueTag field.
	// contains filtered or unexported fields
}

func ParseMVAR

func ParseMVAR(src []byte) (MVAR, int, error)

type Mark2Array

type Mark2Array struct {
	// contains filtered or unexported fields
}

func ParseMark2Array

func ParseMark2Array(src []byte, offsetsCount int) (Mark2Array, int, error)

func (Mark2Array) Anchors

func (ma Mark2Array) Anchors() AnchorMatrix

type MarkArray

type MarkArray struct {
	MarkRecords []MarkRecord `arrayCount:"FirstUint16"` //[markCount]	Array of MarkRecords, ordered by corresponding glyphs in the associated mark Coverage table.
	MarkAnchors []Anchor     `isOpaque:""`              // with same length as MarkRecords
}

func ParseMarkArray

func ParseMarkArray(src []byte) (MarkArray, int, error)

type MarkBasePos

type MarkBasePos struct {
	BaseCoverage Coverage `offsetSize:"Offset16"` // Offset to baseCoverage table, from beginning of MarkBasePos subtable.

	MarkArray MarkArray `offsetSize:"Offset16"`                                          // Offset to MarkArray table, from beginning of MarkBasePos subtable.
	BaseArray BaseArray `offsetSize:"Offset16" arguments:"offsetsCount=.markClassCount"` // Offset to BaseArray table, from beginning of MarkBasePos subtable.
	// contains filtered or unexported fields
}

func ParseMarkBasePos

func ParseMarkBasePos(src []byte) (MarkBasePos, int, error)

func (MarkBasePos) Cov

func (lk MarkBasePos) Cov() Coverage

func (*MarkBasePos) Sanitize

func (mp *MarkBasePos) Sanitize() error

type MarkGlyphSets

type MarkGlyphSets struct {
	Coverages []Coverage `arrayCount:"FirstUint16" offsetsArray:"Offset32"` // [markGlyphSetCount] Array of offsets to mark glyph set coverage tables, from the start of the MarkGlyphSets table.
	// contains filtered or unexported fields
}

func ParseMarkGlyphSets

func ParseMarkGlyphSets(src []byte) (MarkGlyphSets, int, error)

type MarkLigPos

type MarkLigPos struct {
	MarkCoverage     Coverage      `offsetSize:"Offset16"` // Offset to markCoverage table, from beginning of MarkLigPos subtable.
	LigatureCoverage Coverage      `offsetSize:"Offset16"` // Offset to ligatureCoverage table, from beginning of MarkLigPos subtable.
	MarkClassCount   uint16        // Number of defined mark classes
	MarkArray        MarkArray     `offsetSize:"Offset16"`                                          // Offset to MarkArray table, from beginning of MarkLigPos subtable.
	LigatureArray    LigatureArray `offsetSize:"Offset16" arguments:"offsetsCount=.MarkClassCount"` // Offset to LigatureArray table, from beginning of MarkLigPos subtable.
	// contains filtered or unexported fields
}

func ParseMarkLigPos

func ParseMarkLigPos(src []byte) (MarkLigPos, int, error)

func (MarkLigPos) Cov

func (lk MarkLigPos) Cov() Coverage

func (*MarkLigPos) Sanitize

func (mp *MarkLigPos) Sanitize() error

type MarkMarkPos

type MarkMarkPos struct {
	PosFormat      uint16     //	Format identifier: format = 1
	Mark1Coverage  Coverage   `offsetSize:"Offset16"` // Offset to Combining Mark Coverage table, from beginning of MarkMarkPos subtable.
	Mark2Coverage  Coverage   `offsetSize:"Offset16"` // Offset to Base Mark Coverage table, from beginning of MarkMarkPos subtable.
	MarkClassCount uint16     //	Number of Combining Mark classes defined
	Mark1Array     MarkArray  `offsetSize:"Offset16"`                                          //	Offset to MarkArray table for mark1, from beginning of MarkMarkPos subtable.
	Mark2Array     Mark2Array `offsetSize:"Offset16" arguments:"offsetsCount=.MarkClassCount"` //	Offset to Mark2Array table for mark2, from beginning of MarkMarkPos subtable.
}

func ParseMarkMarkPos

func ParseMarkMarkPos(src []byte) (MarkMarkPos, int, error)

func (MarkMarkPos) Cov

func (lk MarkMarkPos) Cov() Coverage

type MarkRecord

type MarkRecord struct {
	MarkClass uint16 // Class defined for the associated mark.
	// contains filtered or unexported fields
}

type Maxp

type Maxp struct {
	NumGlyphs uint16
	// contains filtered or unexported fields
}

https://learn.microsoft.com/en-us/typography/opentype/spec/Maxp

func ParseMaxp

func ParseMaxp(src []byte) (Maxp, int, error)

type Morx

type Morx struct {
	Chains []MorxChain `arrayCount:"ComputedField-nChains"`
	// contains filtered or unexported fields
}

Morx is the extended glyph metamorphosis table See https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6morx.html

func ParseMorx

func ParseMorx(src []byte, valuesCount int) (Morx, int, error)

type MorxChain

type MorxChain struct {
	Flags uint32 // The default specification for subtables.

	Features  []AATFeature        `arrayCount:"ComputedField-nFeatureEntries"`
	Subtables []MorxChainSubtable `arrayCount:"ComputedField-nSubtable"`
	// contains filtered or unexported fields
}

MorxChain is a set of subtables

func ParseMorxChain

func ParseMorxChain(src []byte, valuesCount int) (MorxChain, int, error)

type MorxChainSubtable

type MorxChainSubtable struct {

	// Coverage flags and subtable type.
	Coverage byte

	SubFeatureFlags uint32 // The 32-bit mask identifying which subtable this is (the subtable being executed if the AND of this value and the processed defaultFlags is nonzero)

	Data MorxSubtable `unionField:"version"`
	// contains filtered or unexported fields
}

func ParseMorxChainSubtable

func ParseMorxChainSubtable(src []byte, valuesCount int) (MorxChainSubtable, int, error)

type MorxSubtable

type MorxSubtable interface {
	// contains filtered or unexported methods
}

type MorxSubtableContextual

type MorxSubtableContextual struct {
	AATStateTableExt `arguments:"valuesCount=valuesCount,entryDataSize=4"`
	// Byte offset from the beginning of the state subtable to the beginning of the substitution tables :
	// each value of the array is itself an offet to a aatLookupTable, and the number of
	// items is computed from the header
	Substitutions SubstitutionsTable `offsetSize:"Offset32" arguments:"substitutionsCount=.nSubs(), valuesCount=valuesCount"`
}

binarygen: argument=valuesCount int

func ParseMorxSubtableContextual

func ParseMorxSubtableContextual(src []byte, valuesCount int) (MorxSubtableContextual, int, error)

type MorxSubtableInsertion

type MorxSubtableInsertion struct {
	AATStateTableExt `arguments:"valuesCount=valuesCount,entryDataSize=4"`
	Insertions       []GlyphID `offsetSize:"Offset32" arrayCount:"ComputedField-nInsertions()"` // Byte offset from stateHeader to the start of the insertion glyph table.
}

binarygen: argument=valuesCount int

func ParseMorxSubtableInsertion

func ParseMorxSubtableInsertion(src []byte, valuesCount int) (MorxSubtableInsertion, int, error)

type MorxSubtableLigature

type MorxSubtableLigature struct {
	AATStateTableExt `arguments:"valuesCount=valuesCount, entryDataSize=2"`

	LigActions []uint32  `isOpaque:""`
	Components []uint16  `isOpaque:""`
	Ligatures  []GlyphID `isOpaque:""`
	// contains filtered or unexported fields
}

binarygen: argument=valuesCount int

func ParseMorxSubtableLigature

func ParseMorxSubtableLigature(src []byte, valuesCount int) (MorxSubtableLigature, int, error)

type MorxSubtableNonContextual

type MorxSubtableNonContextual struct {
	// The lookup value is interpreted as a GlyphIndex
	Class AATLookup
}

func ParseMorxSubtableNonContextual

func ParseMorxSubtableNonContextual(src []byte, valuesCount int) (MorxSubtableNonContextual, int, error)

type MorxSubtableRearrangement

type MorxSubtableRearrangement struct {
	AATStateTableExt `arguments:"valuesCount=valuesCount,entryDataSize=0"`
}

binarygen: argument=valuesCount int

func ParseMorxSubtableRearrangement

func ParseMorxSubtableRearrangement(src []byte, valuesCount int) (MorxSubtableRearrangement, int, error)

type MorxSubtableVersion

type MorxSubtableVersion uint8

MorxSubtableVersion indicates the kind of 'morx' subtable. See the constants.

const (
	MorxSubtableVersionRearrangement MorxSubtableVersion = iota
	MorxSubtableVersionContextual
	MorxSubtableVersionLigature

	MorxSubtableVersionNonContextual
	MorxSubtableVersionInsertion
)

type MultipleSubs

type MultipleSubs struct {
	Coverage  Coverage   `offsetSize:"Offset16"` // Offset to Coverage table, from beginning of substitution subtable
	Sequences []Sequence `arrayCount:"FirstUint16"  offsetsArray:"Offset16"`
	// contains filtered or unexported fields
}

func ParseMultipleSubs

func ParseMultipleSubs(src []byte) (MultipleSubs, int, error)

func (MultipleSubs) Cov

func (lk MultipleSubs) Cov() Coverage

func (MultipleSubs) Sanitize

func (ms MultipleSubs) Sanitize() error

type Name

type Name struct {
	// contains filtered or unexported fields
}

Naming table See https://learn.microsoft.com/en-us/typography/opentype/spec/name

func ParseName

func ParseName(src []byte) (Name, int, error)

func (Name) Name

func (names Name) Name(name NameID) string

Name returns the entry at [name], encoded in UTF-8 when possible, or an empty string if not found

type NameID

type NameID uint16

NameID is the ID for entries in the font table.

type OTKernSubtableHeader

type OTKernSubtableHeader struct {
	Coverage byte // What type of information is contained in this table.
	// contains filtered or unexported fields
}

func ParseOTKernSubtableHeader

func ParseOTKernSubtableHeader(src []byte) (OTKernSubtableHeader, int, error)

func (OTKernSubtableHeader) Data

func (k OTKernSubtableHeader) Data() KernData

type Offset16

type Offset16 uint16

Offset16 is an offset into the input byte slice

type Offset32

type Offset32 uint32

Offset32 is an offset into the input byte slice

type Os2

type Os2 struct {
	Version       uint16
	XAvgCharWidth uint16
	USWeightClass uint16
	USWidthClass  uint16

	YSubscriptXSize     int16
	YSubscriptYSize     int16
	YSubscriptXOffset   int16
	YSubscriptYOffset   int16
	YSuperscriptXSize   int16
	YSuperscriptYSize   int16
	YSuperscriptXOffset int16

	YStrikeoutSize     int16
	YStrikeoutPosition int16

	FsSelection      uint16
	USFirstCharIndex uint16
	USLastCharIndex  uint16
	STypoAscender    int16
	STypoDescender   int16
	STypoLineGap     int16

	HigherVersionData []byte `arrayCount:"ToEnd"`
	// contains filtered or unexported fields
}

OS/2 and Windows Metrics Table See https://learn.microsoft.com/en-us/typography/opentype/spec/os2

func ParseOs2

func ParseOs2(src []byte) (Os2, int, error)

func (*Os2) FontPage

func (os *Os2) FontPage() FontPage

type PairPos

type PairPos struct {
	Data PairPosData
}

func ParsePairPos

func ParsePairPos(src []byte) (PairPos, int, error)

func (PairPos) Cov

func (lk PairPos) Cov() Coverage

func (*PairPos) Sanitize

func (pp *PairPos) Sanitize() error

type PairPosData

type PairPosData interface {
	Cov() Coverage
	// contains filtered or unexported methods
}

func ParsePairPosData

func ParsePairPosData(src []byte) (PairPosData, int, error)

type PairPosData1

type PairPosData1 struct {
	ValueFormat1 ValueFormat // Defines the types of data in valueRecord1 — for the first glyph in the pair (may be zero).
	ValueFormat2 ValueFormat // Defines the types of data in valueRecord2 — for the second glyph in the pair (may be zero).
	PairSets     []PairSet   `arrayCount:"FirstUint16" offsetsArray:"Offset16" arguments:"valueFormat1=.ValueFormat1, valueFormat2=.ValueFormat2"` //[pairSetCount] Array of offsets to PairSet tables. Offsets are from beginning of PairPos subtable, ordered by Coverage Index.
	// contains filtered or unexported fields
}

func ParsePairPosData1

func ParsePairPosData1(src []byte) (PairPosData1, int, error)

func (PairPosData1) Cov

func (d PairPosData1) Cov() Coverage

type PairPosData2

type PairPosData2 struct {
	ValueFormat1 ValueFormat //	Defines the types of data in valueRecord1 — for the first glyph in the pair (may be zero).
	ValueFormat2 ValueFormat //	Defines the types of data in valueRecord2 — for the second glyph in the pair (may be zero).

	ClassDef1 ClassDef `offsetSize:"Offset16"` // Offset to ClassDef table, from beginning of PairPos subtable — for the first glyph of the pair.
	ClassDef2 ClassDef `offsetSize:"Offset16"` // Offset to ClassDef table, from beginning of PairPos subtable — for the second glyph of the pair.
	// contains filtered or unexported fields
}

func ParsePairPosData2

func ParsePairPosData2(src []byte) (PairPosData2, int, error)

func (PairPosData2) Cov

func (d PairPosData2) Cov() Coverage

func (*PairPosData2) Record

func (pp *PairPosData2) Record(class1, class2 uint16) Class2Record

Record returns the record for the given classes, which must come from ClassDef1 and ClassDef2

type PairSet

type PairSet struct {
	// contains filtered or unexported fields
}

binarygen: argument=valueFormat1 ValueFormat binarygen: argument=valueFormat2 ValueFormat

func ParsePairSet

func ParsePairSet(src []byte, valueFormat1 ValueFormat, valueFormat2 ValueFormat) (PairSet, int, error)

func (PairSet) FindGlyph

func (ps PairSet) FindGlyph(secondGlyph GlyphID) (PairValueRecord, bool)

FindGlyph performs a binary search in the list, returning the record for `secondGlyph`, or `nil` if not found.

type PairValueRecord

type PairValueRecord struct {
	SecondGlyph  GlyphID     //	Glyph ID of second glyph in the pair (first glyph is listed in the Coverage table).
	ValueRecord1 ValueRecord //	Positioning data for the first glyph in the pair.
	ValueRecord2 ValueRecord //	Positioning data for the second glyph in the pair.
}

type PlatformID

type PlatformID uint16

PlatformID represents the platform id for entries in the name table.

const (
	PlatformUnicode PlatformID = iota
	PlatformMac
	PlatformIso // deprecated
	PlatformMicrosoft
	PlatformCustom

	PlatformAdobe // artificial
)

type Post

type Post struct {

	// UnderlinePosition is the suggested distance of the top of the
	// underline from the baseline (negative values indicate below baseline).
	UnderlinePosition int16
	// Suggested values for the underline thickness.
	UnderlineThickness int16
	// IsFixedPitch indicates that the font is not proportionally spaced
	// (i.e. monospaced).
	IsFixedPitch uint32

	Names PostNames `unionField:"version"`
	// contains filtered or unexported fields
}

PostScript table See https://learn.microsoft.com/en-us/typography/opentype/spec/post

func ParsePost

func ParsePost(src []byte) (Post, int, error)

type PostNames

type PostNames interface {
	// contains filtered or unexported methods
}

type PostNames10

type PostNames10 struct{}

func ParsePostNames10

func ParsePostNames10([]byte) (PostNames10, int, error)

type PostNames20

type PostNames20 struct {
	GlyphNameIndexes []uint16 `arrayCount:"FirstUint16"` // size numGlyph
	StringData       []byte   `arrayCount:"ToEnd"`
}

func ParsePostNames20

func ParsePostNames20(src []byte) (PostNames20, int, error)

type PostNames30

type PostNames30 PostNames10

func ParsePostNames30

func ParsePostNames30([]byte) (PostNames30, int, error)

type RangeRecord

type RangeRecord struct {
	StartGlyphID       GlyphID // First glyph ID in the range
	EndGlyphID         GlyphID // Last glyph ID in the range
	StartCoverageIndex uint16  // Coverage Index of first glyph ID in range
}

type RegionAxisCoordinates

type RegionAxisCoordinates struct {
	StartCoord Coord // The region start coordinate value for the current axis.
	PeakCoord  Coord // The region peak coordinate value for the current axis.
	EndCoord   Coord // The region end coordinate value for the current axis.
}

type ReverseChainSingleSubs

type ReverseChainSingleSubs struct {
	BacktrackCoverages []Coverage `arrayCount:"FirstUint16"  offsetsArray:"Offset16"` //[backtrackGlyphCount]	Array of offsets to coverage tables in backtrack sequence, in glyph sequence order.
	LookaheadCoverages []Coverage `arrayCount:"FirstUint16"  offsetsArray:"Offset16"` //[lookaheadGlyphCount]	Array of offsets to coverage tables in lookahead sequence, in glyph sequence order.
	SubstituteGlyphIDs []GlyphID  `arrayCount:"FirstUint16"`                          //[glyphCount]	Array of substitute glyph IDs — ordered by Coverage index.
	// contains filtered or unexported fields
}

func ParseReverseChainSingleSubs

func ParseReverseChainSingleSubs(src []byte) (ReverseChainSingleSubs, int, error)

func (ReverseChainSingleSubs) Cov

func (ReverseChainSingleSubs) Sanitize

func (rs ReverseChainSingleSubs) Sanitize() error

type SVG

type SVG struct {
	SVGDocumentList SVGDocumentList `offsetSize:"Offset32"` // Offset to the SVG Document List, from the start of the SVG table. Must be non-zero.
	// contains filtered or unexported fields
}

SVG is the SVG (Scalable Vector Graphics) table. See - https://learn.microsoft.com/fr-fr/typography/opentype/spec/svg

func ParseSVG

func ParseSVG(src []byte) (SVG, int, error)

type SVGDocumentList

type SVGDocumentList struct {
	DocumentRecords []SVGDocumentRecord `arrayCount:"FirstUint16"` // [numEntries]	Array of SVG document records.
	SVGRawData      []byte              `subsliceStart:"AtStart" arrayCount:"ToEnd"`
}

func ParseSVGDocumentList

func ParseSVGDocumentList(src []byte) (SVGDocumentList, int, error)

type SVGDocumentRecord

type SVGDocumentRecord struct {
	StartGlyphID GlyphID  // The first glyph ID for the range covered by this record.
	EndGlyphID   GlyphID  // The last glyph ID for the range covered by this record.
	SvgDocOffset Offset32 // Offset from the beginning of the SVGDocumentList to an SVG document. Must be non-zero.
	SvgDocLength uint32   // Length of the SVG document data. Must be non-zero.
}

Each SVG document record specifies a range of glyph IDs (from startGlyphID to endGlyphID, inclusive), and the location of its associated SVG document in the SVG table.

type SbitLineMetrics

type SbitLineMetrics struct {
	Ascender  int8
	Descender int8

	MaxBeforeBL int8
	MinAfterBL  int8
	// contains filtered or unexported fields
}

type Sbix

type Sbix struct {

	// Bit 0: Set to 1.
	// Bit 1: Draw outlines.
	// Bits 2 to 15: reserved (set to 0).
	Flags   uint16
	Strikes []Strike `arrayCount:"FirstUint32" offsetsArray:"Offset32"` // [numStrikes]	Offsets from the beginning of the 'sbix' table to data for each individual bitmap strike.
	// contains filtered or unexported fields
}

Sbix is the Standard Bitmap Graphics Table See - https://learn.microsoft.com/fr-fr/typography/opentype/spec/sbix

func ParseSbix

func ParseSbix(src []byte, numGlyphs int) (Sbix, int, error)

type Script

type Script struct {
	DefaultLangSys *LangSys          `offsetSize:"Offset16"`    // Offset to default LangSys table, from beginning of Script table — may be NULL
	LangSysRecords []TagOffsetRecord `arrayCount:"FirstUint16"` // [langSysCount]	Array of LangSysRecords, listed alphabetically by LangSys tag
	LangSys        []LangSys         `isOpaque:""`              // same length as langSysRecords
}

func ParseScript

func ParseScript(src []byte) (Script, int, error)

func (Script) FindLanguage

func (sc Script) FindLanguage(language Tag) int

FindLanguage looks for language and return its index into the LangSys slice, or -1 if the tag is not found.

func (Script) GetLangSys

func (sc Script) GetLangSys(index uint16) LangSys

GetLangSys return the language at [index]. It [index] is out of range (for example with 0xFFFF), it returns [DefaultLangSys] (which may be empty)

type ScriptList

type ScriptList struct {
	Records []TagOffsetRecord `arrayCount:"FirstUint16"` // Array of ScriptRecords, listed alphabetically by script tag
	Scripts []Script          `isOpaque:""`
}

func ParseScriptList

func ParseScriptList(src []byte) (ScriptList, int, error)

type SegmentMaps

type SegmentMaps struct {
	// [positionMapCount]	The array of axis value map records for this axis.
	// Each axis value map record provides a single axis-value mapping correspondence.
	AxisValueMaps []AxisValueMap `arrayCount:"FirstUint16"`
}

func ParseSegmentMaps

func ParseSegmentMaps(src []byte) (SegmentMaps, int, error)

type Sequence

type Sequence struct {
	SubstituteGlyphIDs []GlyphID `arrayCount:"FirstUint16"` // [glyphCount]	String of glyph IDs to substitute
}

func ParseSequence

func ParseSequence(src []byte) (Sequence, int, error)

type SequenceContextFormat1

type SequenceContextFormat1 struct {
	SeqRuleSet []SequenceRuleSet `arrayCount:"FirstUint16"  offsetsArray:"Offset16"` //[seqRuleSetCount]	Array of offsets to SequenceRuleSet tables, from beginning of SequenceContextFormat1 table (offsets may be NULL)
	// contains filtered or unexported fields
}

type SequenceContextFormat2

type SequenceContextFormat2 struct {
	ClassDef        ClassDef               `offsetSize:"Offset16"`                            //	Offset to ClassDef table, from beginning of SequenceContextFormat2 table
	ClassSeqRuleSet []ClassSequenceRuleSet `arrayCount:"FirstUint16" offsetsArray:"Offset16"` //[classSeqRuleSetCount]	Array of offsets to ClassSequenceRuleSet tables, from beginning of SequenceContextFormat2 table (may be NULL)
	// contains filtered or unexported fields
}

type SequenceContextFormat3

type SequenceContextFormat3 struct {
	Coverages        []Coverage             `arrayCount:"ComputedField-glyphCount" offsetsArray:"Offset16"` //[glyphCount]	Array of offsets to Coverage tables, from beginning of SequenceContextFormat3 subtable
	SeqLookupRecords []SequenceLookupRecord `arrayCount:"ComputedField-seqLookupCount"`                     //[seqLookupCount]	Array of SequenceLookupRecords
	// contains filtered or unexported fields
}

type SequenceLookupRecord

type SequenceLookupRecord struct {
	SequenceIndex   uint16 // Index (zero-based) into the input glyph sequence
	LookupListIndex uint16 // Index (zero-based) into the LookupList
}

type SequenceRule

type SequenceRule struct {
	InputSequence    []GlyphID              `arrayCount:"ComputedField-glyphCount-1"`   //[glyphCount - 1]	Array of input glyph IDs—starting with the second glyph
	SeqLookupRecords []SequenceLookupRecord `arrayCount:"ComputedField-seqLookupCount"` //[seqLookupCount]	Array of Sequence lookup records
	// contains filtered or unexported fields
}

func ParseSequenceRule

func ParseSequenceRule(src []byte) (SequenceRule, int, error)

type SequenceRuleSet

type SequenceRuleSet struct {
	SeqRule []SequenceRule `arrayCount:"FirstUint16" offsetsArray:"Offset16"` // Array of offsets to SequenceRule tables, from beginning of the SequenceRuleSet table
}

func ParseSequenceRuleSet

func ParseSequenceRuleSet(src []byte) (SequenceRuleSet, int, error)

type SequentialMapGroup

type SequentialMapGroup struct {
	StartCharCode uint32 //	First character code in this group
	EndCharCode   uint32 //	Last character code in this group
	StartGlyphID  uint32 //	Glyph index corresponding to the starting character code
}

type SharedTuples

type SharedTuples struct {
	SharedTuples []Tuple // [sharedTupleCount] Array of tuple records shared across all glyph variation data tables.
}

func ParseSharedTuples

func ParseSharedTuples(src []byte, sharedTuplesCount int, valuesCount int) (SharedTuples, int, error)

type SimpleGlyph

type SimpleGlyph struct {
	EndPtsOfContours []uint16            // [numberOfContours] Array of point indices for the last point of each contour, in increasing numeric order.
	Instructions     []byte              `arrayCount:"FirstUint16"` // [instructionLength] Array of instruction byte code for the glyph.
	Points           []GlyphContourPoint `isOpaque:"" subsliceStart:"AtCurrent"`
}

func ParseSimpleGlyph

func ParseSimpleGlyph(src []byte, endPtsOfContoursCount int) (SimpleGlyph, int, error)

type SinglePos

type SinglePos struct {
	Data SinglePosData
}

func ParseSinglePos

func ParseSinglePos(src []byte) (SinglePos, int, error)

func (SinglePos) Cov

func (lk SinglePos) Cov() Coverage

func (*SinglePos) Sanitize

func (sp *SinglePos) Sanitize() error

type SinglePosData

type SinglePosData interface {
	Cov() Coverage
	// contains filtered or unexported methods
}

func ParseSinglePosData

func ParseSinglePosData(src []byte) (SinglePosData, int, error)

type SinglePosData1

type SinglePosData1 struct {
	ValueFormat ValueFormat //	Defines the types of data in the ValueRecord.
	ValueRecord ValueRecord `isOpaque:""` //	Defines positioning value(s) — applied to all glyphs in the Coverage table.
	// contains filtered or unexported fields
}

func ParseSinglePosData1

func ParseSinglePosData1(src []byte) (SinglePosData1, int, error)

func (SinglePosData1) Cov

func (d SinglePosData1) Cov() Coverage

type SinglePosData2

type SinglePosData2 struct {
	ValueFormat ValueFormat // Defines the types of data in the ValueRecords.

	ValueRecords []ValueRecord `isOpaque:""` //[valueCount]	Array of ValueRecords — positioning values applied to glyphs.
	// contains filtered or unexported fields
}

func ParseSinglePosData2

func ParseSinglePosData2(src []byte) (SinglePosData2, int, error)

func (SinglePosData2) Cov

func (d SinglePosData2) Cov() Coverage

type SingleSubs

type SingleSubs struct {
	Data SingleSubstData
}

func ParseSingleSubs

func ParseSingleSubs(src []byte) (SingleSubs, int, error)

func (SingleSubs) Cov

func (lk SingleSubs) Cov() Coverage

type SingleSubstData

type SingleSubstData interface {
	Cov() Coverage
	// contains filtered or unexported methods
}

func ParseSingleSubstData

func ParseSingleSubstData(src []byte) (SingleSubstData, int, error)

type SingleSubstData1

type SingleSubstData1 struct {
	Coverage     Coverage `offsetSize:"Offset16"` // Offset to Coverage table, from beginning of substitution subtable
	DeltaGlyphID int16    // Add to original glyph ID to get substitute glyph ID
	// contains filtered or unexported fields
}

func ParseSingleSubstData1

func ParseSingleSubstData1(src []byte) (SingleSubstData1, int, error)

func (SingleSubstData1) Cov

func (d SingleSubstData1) Cov() Coverage

type SingleSubstData2

type SingleSubstData2 struct {
	Coverage           Coverage  `offsetSize:"Offset16"`    // Offset to Coverage table, from beginning of substitution subtable
	SubstituteGlyphIDs []GlyphID `arrayCount:"FirstUint16"` //[glyphCount]	Array of substitute glyph IDs — ordered by Coverage index
	// contains filtered or unexported fields
}

func ParseSingleSubstData2

func ParseSingleSubstData2(src []byte) (SingleSubstData2, int, error)

func (SingleSubstData2) Cov

func (d SingleSubstData2) Cov() Coverage

type SmallGlyphMetrics

type SmallGlyphMetrics struct {
	Height   uint8 // Number of rows of data.
	Width    uint8 // Number of columns of data.
	BearingX int8  // Distance in pixels from the horizontal origin to the left edge of the bitmap.
	BearingY int8  // Distance in pixels from the horizontal origin to the top edge of the bitmap.
	Advance  uint8 // Horizontal advance width in pixels.
}

type Strike

type Strike struct {
	Ppem       uint16            // The PPEM size for which this strike was designed.
	Ppi        uint16            // The device pixel density (in PPI) for which this strike was designed. (E.g., 96 PPI, 192 PPI.)
	GlyphDatas []BitmapGlyphData `isOpaque:""` //[numGlyphs+1] Offset from the beginning of the strike data header to bitmap data for an individual glyph ID.
}

Strike stores one size of bitmap glyphs in the 'sbix' table. binarygen: argument=numGlyphs int

func ParseStrike

func ParseStrike(src []byte, numGlyphs int) (Strike, int, error)

type SubstitutionsTable

type SubstitutionsTable struct {
	Substitutions []AATLookup `offsetsArray:"Offset32"`
}

func ParseSubstitutionsTable

func ParseSubstitutionsTable(src []byte, substitutionsCount int, valuesCount int) (SubstitutionsTable, int, error)

type Tag

type Tag = loader.Tag

type TagOffsetRecord

type TagOffsetRecord struct {
	Tag    Tag    // 4-byte script tag identifier
	Offset uint16 // Offset to object from beginning of list
}

type TrackData

type TrackData struct {
	SizeTable  []Float1616       `offsetSize:"Offset32" offsetRelativeTo:"Parent" arrayCount:"ComputedField-nSizes"` // Offset from start of the tracking table to the start of the size subtable.
	TrackTable []TrackTableEntry `arrayCount:"ComputedField-nTracks" arguments:"perSizeTrackingCount=.nSizes"`       // Array[nTracks] of TrackTableEntry records.
	// contains filtered or unexported fields
}

func ParseTrackData

func ParseTrackData(src []byte, parentSrc []byte) (TrackData, int, error)

type TrackTableEntry

type TrackTableEntry struct {
	Track           Float1616 // Track value for this record.
	NameIndex       uint16    // The 'name' table index for this track (a short word or phrase like "loose" or "very tight"). NameIndex has a value greater than 255 and less than 32768.
	PerSizeTracking []int16   `offsetSize:"Offset16" offsetRelativeTo:"GrandParent"` // in font units, with length len(SizeTable)
}

func ParseTrackTableEntry

func ParseTrackTableEntry(src []byte, grandParentSrc []byte, perSizeTrackingCount int) (TrackTableEntry, int, error)

type Trak

type Trak struct {
	Horiz TrackData `offsetSize:"Offset16"` // Offset from start of tracking table to TrackData for horizontal text (or 0 if none).
	Vert  TrackData `offsetSize:"Offset16"` // Offset from start of tracking table to TrackData for vertical text (or 0 if none).
	// contains filtered or unexported fields
}

Trak is the tracking table. See - https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6trak.html

func ParseTrak

func ParseTrak(src []byte) (Trak, int, error)

func (Trak) IsEmpty

func (t Trak) IsEmpty() bool

IsEmpty return `true` it the table has no entries.

type Tuple

type Tuple struct {
	Values []Coord // [axisCount] Coordinate array specifying a position within the font’s variation space. The number of elements must match the axisCount specified in the 'fvar' table.
}

func ParseTuple

func ParseTuple(src []byte, valuesCount int) (Tuple, int, error)

type TupleVariationHeader

type TupleVariationHeader struct {
	VariationDataSize uint16 //	The size in bytes of the serialized data for this tuple variation table.

	// Peak tuple record for this tuple variation table — optional, determined by flags in the tupleIndex value.
	// Note that this must always be included in the 'cvar' table.
	PeakTuple          Tuple    `isOpaque:"" subsliceStart:"AtCurrent"`
	IntermediateTuples [2]Tuple `isOpaque:"" subsliceStart:"AtCurrent"` //	Intermediate start/end tuple record for this tuple variation table — optional, determined by flags in the tupleIndex value.
	// contains filtered or unexported fields
}

binarygen: argument=axisCount int

func ParseTupleVariationHeader

func ParseTupleVariationHeader(src []byte, axisCount int) (TupleVariationHeader, int, error)

func (*TupleVariationHeader) HasPrivatePointNumbers

func (t *TupleVariationHeader) HasPrivatePointNumbers() bool

HasPrivatePointNumbers returns true if the flag 'privatePointNumbers' is on

func (*TupleVariationHeader) Index

func (t *TupleVariationHeader) Index() uint16

Index returns the tuple index, after masking

type UVSMappingTable

type UVSMappingTable struct {
	Ranges []UvsMappingRecord `arrayCount:"FirstUint32"`
}

UVSMappingTable is used in Cmap format 14 See https://learn.microsoft.com/en-us/typography/opentype/spec/cmap#non-default-uvs-table

func ParseUVSMappingTable

func ParseUVSMappingTable(src []byte) (UVSMappingTable, int, error)

type UnicodeRange

type UnicodeRange struct {
	StartUnicodeValue [3]byte // uint24 First value in this range
	AdditionalCount   uint8   // Number of additional values in this range
}

type UvsMappingRecord

type UvsMappingRecord struct {
	UnicodeValue [3]byte // uint24 Base Unicode value of the UVS
	GlyphID      GlyphID //	Glyph ID of the UVS
}

type VORG

type VORG struct {
	DefaultVertOriginY int16               //	The y coordinate of a glyph’s vertical origin, in the font’s design coordinate system, to be used if no entry is present for the glyph in the vertOriginYMetrics array.
	VertOriginYMetrics []VertOriginYMetric `arrayCount:"FirstUint16"`
	// contains filtered or unexported fields
}

VORG is the Vertical Origin Table See - https://learn.microsoft.com/fr-fr/typography/opentype/spec/vorg

func ParseVORG

func ParseVORG(src []byte) (VORG, int, error)

func (*VORG) YOrigin

func (t *VORG) YOrigin(glyph GlyphID) int16

YOrigin returns the vertical origin for [glyph].

type ValueFormat

type ValueFormat uint16

ValueFormat is a mask indicating which field are set in a GPOS ValueRecord. It is often shared between many records.

const (
	XPlacement ValueFormat = 1 << iota // Includes horizontal adjustment for placement
	YPlacement                         // Includes vertical adjustment for placement
	XAdvance                           // Includes horizontal adjustment for advance
	YAdvance                           // Includes vertical adjustment for advance
	XPlaDevice                         // Includes horizontal Device table for placement
	YPlaDevice                         // Includes vertical Device table for placement
	XAdvDevice                         // Includes horizontal Device table for advance
	YAdvDevice                         // Includes vertical Device table for advance

	//  Mask for having any Device table
	Devices = XPlaDevice | YPlaDevice | XAdvDevice | YAdvDevice
)

type ValueRecord

type ValueRecord struct {
	XPlacement int16       // Horizontal adjustment for placement, in design units.
	YPlacement int16       // Vertical adjustment for placement, in design units.
	XAdvance   int16       // Horizontal adjustment for advance, in design units — only used for horizontal layout.
	YAdvance   int16       // Vertical adjustment for advance, in design units — only used for vertical layout.
	XPlaDevice DeviceTable // Offset to Device table (non-variable font) / VariationIndex table (variable font) for horizontal placement, from beginning of the immediate parent table (SinglePos or PairPosFormat2 lookup subtable, PairSet table within a PairPosFormat1 lookup subtable) — may be NULL.
	YPlaDevice DeviceTable // Offset to Device table (non-variable font) / VariationIndex table (variable font) for vertical placement, from beginning of the immediate parent table (SinglePos or PairPosFormat2 lookup subtable, PairSet table within a PairPosFormat1 lookup subtable) — may be NULL.
	XAdvDevice DeviceTable // Offset to Device table (non-variable font) / VariationIndex table (variable font) for horizontal advance, from beginning of the immediate parent table (SinglePos or PairPosFormat2 lookup subtable, PairSet table within a PairPosFormat1 lookup subtable) — may be NULL.
	YAdvDevice DeviceTable // Offset to Device table (non-variable font) / VariationIndex table (variable font) for vertical advance, from beginning of the immediate parent table (SinglePos or PairPosFormat2 lookup subtable, PairSet table within a PairPosFormat1 lookup su
}

ValueRecord has optional fields

type VarValueRecord

type VarValueRecord struct {
	ValueTag Tag                 // Four-byte tag identifying a font-wide measure.
	Index    VariationStoreIndex // A delta-set index — used to select an item variation data subtable within the item variation store.
}

func ParseVarValueRecord

func ParseVarValueRecord(src []byte) (VarValueRecord, int, error)

type VariationAxisRecord

type VariationAxisRecord struct {
	Tag     Tag       // Tag identifying the design variation for the axis.
	Minimum Float1616 // mininum value on the variation axis that the font covers
	Default Float1616 // default position on the axis
	Maximum Float1616 // maximum value on the variation axis that the font covers
	// contains filtered or unexported fields
}

type VariationRegion

type VariationRegion struct {
	// Array of region axis coordinates records, in the order of axes given in the 'fvar' table.
	// Each RegionAxisCoordinates record provides coordinate values for a region along a single axis:
	RegionAxes []RegionAxisCoordinates // [axisCount]
}

func ParseVariationRegion

func ParseVariationRegion(src []byte, regionAxesCount int) (VariationRegion, int, error)

func (VariationRegion) Evaluate

func (vr VariationRegion) Evaluate(coords []Coord) float32

Evaluate returns the scalar factor of the region

type VariationRegionList

type VariationRegionList struct {
	VariationRegions []VariationRegion `arrayCount:"FirstUint16" arguments:"regionAxesCount=.axisCount"` // [regionCount] Array of variation regions.
	// contains filtered or unexported fields
}

func ParseVariationRegionList

func ParseVariationRegionList(src []byte) (VariationRegionList, int, error)

type VariationSelector

type VariationSelector struct {
	VarSelector   [3]byte         // uint24 Variation selector
	DefaultUVS    DefaultUVSTable `offsetSize:"Offset32"  offsetRelativeTo:"Parent"` // Offset from the start of the format 14 subtable to Default UVS Table. May be 0.
	NonDefaultUVS UVSMappingTable `offsetSize:"Offset32"  offsetRelativeTo:"Parent"` // Offset from the start of the format 14 subtable to Non-Default UVS Table. May be 0.
}

func ParseVariationSelector

func ParseVariationSelector(src []byte, parentSrc []byte) (VariationSelector, int, error)

type VariationStoreIndex

type VariationStoreIndex struct {
	DeltaSetOuter, DeltaSetInner uint16
}

VariationStoreIndex reference an item in the variation store

type VertOriginYMetric

type VertOriginYMetric struct {
	GlyphIndex  GlyphID //  Glyph index.
	VertOriginY int16   //  Y coordinate, in the font’s design coordinate system, of the vertical origin of glyph with index glyphIndex.
}

Jump to

Keyboard shortcuts

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