gtab

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: GPL-3.0 Imports: 17 Imported by: 3

Documentation

Overview

Package gtab reads and writes "GSUB" and "GPOS" tables. The main entry point is the Info type, which represents a parsed GSUB or GPOS table.

Index

Constants

View Source
const (
	GposExtensionLookupType uint16 = 9
	GsubExtensionLookupType uint16 = 7
)

Lookup types for extension lookup records. This can be used as an argument for the Info.Encode method.

Variables

View Source
var (
	// GsubDefaultFeatures can be used as an argument for the Info.FindLookups()
	// method.
	GsubDefaultFeatures = map[string]bool{
		"calt": true,
		"ccmp": true,
		"clig": true,
		"liga": true,
		"locl": true,
	}

	// GposDefaultFeatures can be used as an argument for the Info.FindLookups()
	// method.
	GposDefaultFeatures = map[string]bool{
		"kern": true,
		"mark": true,
		"mkmk": true,
	}
)

Functions

This section is empty.

Types

type ChainedClassSeqRule

type ChainedClassSeqRule struct {
	Backtrack []uint16
	Input     []uint16 // excludes the first input glyph, since this is in Cov
	Lookahead []uint16
	Actions   SeqLookups
}

ChainedClassSeqRule is used to represent the rules in a ChainedSeqContext2. It describes a sequence of nested lookups together with the context where they apply. The Backtrack, Input and Lookahead sequences are given as lists of glyph classes, as defined by the corresponding class definition tables in the ChainedSeqContext2 structure.

type ChainedSeqContext1

type ChainedSeqContext1 struct {
	Cov   coverage.Table
	Rules [][]*ChainedSeqRule // indexed by coverage index
}

ChainedSeqContext1 is used for GSUB type 6 format 1 and GPOS type 8 format 1 subtables. https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#chained-sequence-context-format-1-simple-glyph-contexts

func (*ChainedSeqContext1) Apply

func (l *ChainedSeqContext1) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*ChainedSeqContext1) Encode

func (l *ChainedSeqContext1) Encode() []byte

Encode implements the Subtable interface.

func (*ChainedSeqContext1) EncodeLen

func (l *ChainedSeqContext1) EncodeLen() int

EncodeLen implements the Subtable interface.

type ChainedSeqContext2

type ChainedSeqContext2 struct {
	Cov       coverage.Table
	Backtrack classdef.Table
	Input     classdef.Table
	Lookahead classdef.Table
	Rules     [][]*ChainedClassSeqRule // indexed by input glyph class
}

ChainedSeqContext2 is used for GSUB type 6 format 2 and GPOS type 8 format 2 subtables. https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#chained-sequence-context-format-2-class-based-glyph-contexts

func (*ChainedSeqContext2) Apply

func (l *ChainedSeqContext2) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*ChainedSeqContext2) Encode

func (l *ChainedSeqContext2) Encode() []byte

Encode implements the Subtable interface.

func (*ChainedSeqContext2) EncodeLen

func (l *ChainedSeqContext2) EncodeLen() int

EncodeLen implements the Subtable interface.

type ChainedSeqContext3

type ChainedSeqContext3 struct {
	Backtrack []coverage.Set
	Input     []coverage.Set
	Lookahead []coverage.Set
	Actions   SeqLookups
}

ChainedSeqContext3 is used for GSUB type 6 and GPOS type 8 format 3 subtables https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#chained-sequence-context-format-3-coverage-based-glyph-contexts

func (*ChainedSeqContext3) Apply

func (l *ChainedSeqContext3) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*ChainedSeqContext3) Encode

func (l *ChainedSeqContext3) Encode() []byte

Encode implements the Subtable interface.

func (*ChainedSeqContext3) EncodeLen

func (l *ChainedSeqContext3) EncodeLen() int

EncodeLen implements the Subtable interface.

type ChainedSeqRule

type ChainedSeqRule struct {
	Backtrack []glyph.ID
	Input     []glyph.ID // excludes the first input glyph, since this is in Cov
	Lookahead []glyph.ID
	Actions   SeqLookups
}

ChainedSeqRule describes the rules in a ChainedSeqContext1.

type ClassSeqRule

type ClassSeqRule struct {
	Input   []uint16 // excludes the first input glyph
	Actions SeqLookups
}

ClassSeqRule describes a sequence of glyph classes and the actions to be performed

type EntryExitRecord

type EntryExitRecord struct {
	Entry anchor.Table
	Exit  anchor.Table
}

EntryExitRecord is an OpenType EntryExitRecord table. The Exit anchor point of a glyph is aligned with the Entry anchor point of the following glyph.

type Feature

type Feature struct {
	// Tag describes the function of this feature.
	// https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags
	Tag string

	// Lookups is a list of lookup indices that are used by this feature.
	Lookups []LookupIndex
}

Feature describes an OpenType feature, used either in a "GPOS" or "GSUB" table.

func (Feature) String

func (f Feature) String() string

type FeatureIndex

type FeatureIndex uint16

FeatureIndex enumerates features. It is used as an index into the FeatureListInfo. Valid values are in the range from 0 to 0xFFFE. The special value 0xFFFF is used to indicate the absence of required features in the `Features` struct.

type FeatureListInfo

type FeatureListInfo []*Feature

FeatureListInfo contains the contents of an OpenType "Feature List" table.

type Features

type Features struct {
	Required FeatureIndex // 0xFFFF, if no required feature
	Optional []FeatureIndex
}

Features describes the mandatory and optional features for a script/language.

type Gpos1_1

type Gpos1_1 struct {
	Cov    coverage.Table
	Adjust *GposValueRecord
}

Gpos1_1 is a Single Adjustment Positioning Subtable (GPOS type 1, format 1). If specifies a single adjustment to be applied to all glyphs in the coverage table. https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#single-adjustment-positioning-format-1-single-positioning-value

func (*Gpos1_1) Apply

func (l *Gpos1_1) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*Gpos1_1) Encode

func (l *Gpos1_1) Encode() []byte

Encode implements the Subtable interface.

func (*Gpos1_1) EncodeLen

func (l *Gpos1_1) EncodeLen() int

EncodeLen implements the Subtable interface.

type Gpos1_2

type Gpos1_2 struct {
	Cov    coverage.Table
	Adjust []*GposValueRecord // indexed by coverage index
}

Gpos1_2 is a Single Adjustment Positioning Subtable (GPOS type 1, format 2) https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#single-adjustment-positioning-format-2-array-of-positioning-values

func (*Gpos1_2) Apply

func (l *Gpos1_2) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*Gpos1_2) Encode

func (l *Gpos1_2) Encode() []byte

Encode implements the Subtable interface.

func (*Gpos1_2) EncodeLen

func (l *Gpos1_2) EncodeLen() int

EncodeLen implements the Subtable interface.

type Gpos2_1

type Gpos2_1 map[glyph.Pair]*PairAdjust

Gpos2_1 is a Pair Adjustment Positioning Subtable (format 1) https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#pair-adjustment-positioning-format-1-adjustments-for-glyph-pairs

func (Gpos2_1) Apply

func (l Gpos2_1) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (Gpos2_1) CovAndAdjust added in v0.3.5

func (l Gpos2_1) CovAndAdjust() (coverage.Table, []map[glyph.ID]*PairAdjust)

func (Gpos2_1) Encode

func (l Gpos2_1) Encode() []byte

Encode implements the Subtable interface.

func (Gpos2_1) EncodeLen

func (l Gpos2_1) EncodeLen() int

EncodeLen implements the Subtable interface.

type Gpos2_2

type Gpos2_2 struct {
	Cov            coverage.Set
	Class1, Class2 classdef.Table
	Adjust         [][]*PairAdjust // indexed by class1 index, then class2 index
}

Gpos2_2 is a Pair Adjustment Positioning Subtable (format 2) https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#pair-adjustment-positioning-format-2-class-pair-adjustment

func (*Gpos2_2) Apply

func (l *Gpos2_2) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*Gpos2_2) Encode

func (l *Gpos2_2) Encode() []byte

Encode implements the Subtable interface.

func (*Gpos2_2) EncodeLen

func (l *Gpos2_2) EncodeLen() int

EncodeLen implements the Subtable interface.

type Gpos3_1

type Gpos3_1 struct {
	Cov     coverage.Table
	Records []EntryExitRecord // indexed by coverage index
}

Gpos3_1 is a Cursive Attachment Positioning subtable (format 1). https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#cursive-attachment-positioning-format1-cursive-attachment

func (*Gpos3_1) Apply

func (l *Gpos3_1) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*Gpos3_1) Encode

func (l *Gpos3_1) Encode() []byte

Encode implements the Subtable interface.

func (*Gpos3_1) EncodeLen

func (l *Gpos3_1) EncodeLen() int

EncodeLen implements the Subtable interface.

type Gpos4_1

type Gpos4_1 struct {
	MarkCov   coverage.Table
	BaseCov   coverage.Table
	MarkArray []markarray.Record // indexed by mark coverage index
	BaseArray [][]anchor.Table   // indexed by base coverage index, then by mark class
}

Gpos4_1 is a Mark-to-Base Attachment Positioning Subtable (format 1) https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#mark-to-base-attachment-positioning-format-1-mark-to-base-attachment-point

func (*Gpos4_1) Apply

func (l *Gpos4_1) Apply(_ keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*Gpos4_1) Encode

func (l *Gpos4_1) Encode() []byte

Encode implements the Subtable interface.

func (*Gpos4_1) EncodeLen

func (l *Gpos4_1) EncodeLen() int

EncodeLen implements the Subtable interface.

type Gpos6_1

type Gpos6_1 struct {
	Mark1Cov   coverage.Table
	Mark2Cov   coverage.Table
	Mark1Array []markarray.Record // indexed by mark1 coverage index
	Mark2Array [][]anchor.Table   // indexed by mark2 coverage index, then by mark class
}

Gpos6_1 is a Mark-to-Mark Attachment Positioning Subtable (format 1) https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#lookup-type-6-mark-to-mark-attachment-positioning-subtable

func (*Gpos6_1) Apply

func (l *Gpos6_1) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*Gpos6_1) Encode

func (l *Gpos6_1) Encode() []byte

Encode implements the Subtable interface.

func (*Gpos6_1) EncodeLen

func (l *Gpos6_1) EncodeLen() int

EncodeLen implements the Subtable interface.

type GposValueRecord

type GposValueRecord struct {
	XPlacement        funit.Int16 // Horizontal adjustment for placement
	YPlacement        funit.Int16 // Vertical adjustment for placement
	XAdvance          funit.Int16 // Horizontal adjustment for advance
	YAdvance          funit.Int16 // Vertical adjustment for advance
	XPlacementDevOffs uint16      // Offset to Device table/VariationIndex table for horizontal placement
	YPlacementDevOffs uint16      // Offset to Device table/VariationIndex table for vertical placement
	XAdvanceDevOffs   uint16      // Offset to Device table/VariationIndex table for horizontal advance
	YAdvanceDevOffs   uint16      // Offset to Device table/VariationIndex table for vertical advance
}

GposValueRecord describes an adjustment to the position of a glyph or set of glyphs. https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#value-record

func (*GposValueRecord) Apply

func (vr *GposValueRecord) Apply(glyph *glyph.Info)

Apply adjusts the position of a glyph according to the value record.

func (*GposValueRecord) String

func (vr *GposValueRecord) String() string

type Gsub1_1

type Gsub1_1 struct {
	Cov   coverage.Set
	Delta glyph.ID
}

Gsub1_1 is a Single Substitution subtable (GSUB type 1, format 1). Lookups of this type allow to replace a single glyph with another glyph. The original glyph must be contained in the coverage table. The new glyph is determined by adding `delta` to the original glyph's GID. https://docs.microsoft.com/en-us/typography/opentype/spec/gsub#11-single-substitution-format-1

func (*Gsub1_1) Apply

func (l *Gsub1_1) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*Gsub1_1) Encode

func (l *Gsub1_1) Encode() []byte

Encode implements the Subtable interface.

func (*Gsub1_1) EncodeLen

func (l *Gsub1_1) EncodeLen() int

EncodeLen implements the Subtable interface.

type Gsub1_2

type Gsub1_2 struct {
	Cov                coverage.Table
	SubstituteGlyphIDs []glyph.ID // indexed by coverage index
}

Gsub1_2 is a Single Substitution GSUB subtable (type 1, format 2). Lookups of this type allow to replace a single glyph with another glyph. The original glyph must be contained in the coverage table. The new glyph is found by looking up the replacement GID in the SubstituteGlyphIDs table (indexed by the coverage index of the original GID). https://docs.microsoft.com/en-us/typography/opentype/spec/gsub#12-single-substitution-format-2

func (*Gsub1_2) Apply

func (l *Gsub1_2) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*Gsub1_2) Encode

func (l *Gsub1_2) Encode() []byte

Encode implements the Subtable interface.

func (*Gsub1_2) EncodeLen

func (l *Gsub1_2) EncodeLen() int

EncodeLen implements the Subtable interface.

type Gsub2_1

type Gsub2_1 struct {
	Cov  coverage.Table
	Repl [][]glyph.ID // indexed by coverage index
}

Gsub2_1 is a Multiple Substitution GSUB subtable (type 2, format 1). Lookups of this type allow to replace a single glyph with multiple glyphs. The original glyph must be contained in the coverage table. The new glyphs are found by looking up the replacement GIDs in the `Repl` table (indexed by the coverage index of the original GID). Replacement sequences must have at least one glyph. https://docs.microsoft.com/en-us/typography/opentype/spec/gsub#21-multiple-substitution-format-1

func (*Gsub2_1) Apply

func (l *Gsub2_1) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*Gsub2_1) Encode

func (l *Gsub2_1) Encode() []byte

Encode implements the Subtable interface.

func (*Gsub2_1) EncodeLen

func (l *Gsub2_1) EncodeLen() int

EncodeLen implements the Subtable interface.

type Gsub3_1

type Gsub3_1 struct {
	Cov        coverage.Table
	Alternates [][]glyph.ID
}

Gsub3_1 is an Alternate Substitution GSUB subtable (type 3, format 1). https://docs.microsoft.com/en-us/typography/opentype/spec/gsub#31-alternate-substitution-format-1

func (*Gsub3_1) Apply

func (l *Gsub3_1) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*Gsub3_1) Encode

func (l *Gsub3_1) Encode() []byte

Encode implements the Subtable interface.

func (*Gsub3_1) EncodeLen

func (l *Gsub3_1) EncodeLen() int

EncodeLen implements the Subtable interface.

type Gsub4_1

type Gsub4_1 struct {
	Cov  coverage.Table
	Repl [][]Ligature // indexed by coverage index
}

Gsub4_1 is a Ligature Substitution GSUB subtable (type 4, format 1). Lookups of this type replace a sequence of glyphs with a single glyph. https://docs.microsoft.com/en-us/typography/opentype/spec/gsub#41-ligature-substitution-format-1

func (*Gsub4_1) Apply

func (l *Gsub4_1) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*Gsub4_1) Encode

func (l *Gsub4_1) Encode() []byte

Encode implements the Subtable interface.

func (*Gsub4_1) EncodeLen

func (l *Gsub4_1) EncodeLen() int

EncodeLen implements the Subtable interface.

type Gsub8_1

type Gsub8_1 struct {
	Input              coverage.Table
	Backtrack          []coverage.Table
	Lookahead          []coverage.Table
	SubstituteGlyphIDs []glyph.ID // indexed by input coverage index
}

Gsub8_1 is a Reverse Chaining Contextual Single Substitution GSUB subtable (type 8, format 1). https://docs.microsoft.com/en-us/typography/opentype/spec/gsub#81-reverse-chaining-contextual-single-substitution-format-1-coverage-based-glyph-contexts

func (*Gsub8_1) Apply

func (l *Gsub8_1) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*Gsub8_1) Encode

func (l *Gsub8_1) Encode() []byte

Encode implements the Subtable interface.

func (*Gsub8_1) EncodeLen

func (l *Gsub8_1) EncodeLen() int

EncodeLen implements the Subtable interface.

type Info

type Info struct {
	ScriptList  ScriptListInfo
	FeatureList FeatureListInfo
	LookupList  LookupList
}

Info contains the information from a "GSUB" or "GPOS" table.

func ReadGPOS

func ReadGPOS(r parser.ReadSeekSizer) (*Info, error)

ReadGPOS reads and decodes an OpenType "GPOS" table from r. https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#gpos-header

func ReadGSUB

func ReadGSUB(r parser.ReadSeekSizer) (*Info, error)

ReadGSUB reads and decodes an OpenType "GSUB" table from r. https://docs.microsoft.com/en-us/typography/opentype/spec/gsub#gsub-header

func (*Info) Encode

func (info *Info) Encode(extLookupType uint16) []byte

Encode returns the binary representation of a "GSUB" or "GPOS" table.

func (*Info) FindLookups

func (info *Info) FindLookups(lang language.Tag, includeFeature map[string]bool) []LookupIndex

FindLookups returns the lookups required to implement the given features in the specified language.

type Ligature

type Ligature struct {
	// In is the sequence of input glyphs that is replaced by Out, excluding
	// the first glyph in the sequence (since this is in Cov).
	//
	// The order in the Ligature offset array defines the preference for using
	// the ligatures, for example "ffl" is only applied if it comes before "ff".
	In []glyph.ID

	Out glyph.ID
}

Ligature represents a substitution of a sequence of glyphs into a single glyph in a Gsub4_1 subtable.

type LookupFlags

type LookupFlags uint16

LookupFlags contains bits which modify application of a lookup to a glyph string. https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#lookupFlags

const (
	LookupRightToLeft         LookupFlags = 0x0001
	LookupIgnoreBaseGlyphs    LookupFlags = 0x0002
	LookupIgnoreLigatures     LookupFlags = 0x0004
	LookupIgnoreMarks         LookupFlags = 0x0008
	LookupUseMarkFilteringSet LookupFlags = 0x0010
	LookupMarkAttachTypeMask  LookupFlags = 0xFF00
)

Bit values for LookupFlag.

type LookupIndex

type LookupIndex uint16

LookupIndex enumerates lookups. It is used as an index into a LookupList.

type LookupList

type LookupList []*LookupTable

LookupList contains the information from a Lookup List Table. https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#lookup-list-table

func (LookupList) ApplyLookup

func (ll LookupList) ApplyLookup(seq []glyph.Info, lookupIndex LookupIndex, gdef *gdef.Table) []glyph.Info

ApplyLookup applies a single lookup to the given glyphs.

type LookupMetaInfo

type LookupMetaInfo struct {
	LookupType       uint16
	LookupFlag       LookupFlags
	MarkFilteringSet uint16
}

LookupMetaInfo contains information associated with a lookup but not specific to a subtable.

type LookupTable

type LookupTable struct {
	Meta *LookupMetaInfo

	// Subtables contains subtables to try for this lookup.  The subtables
	// are tried in order, until one of them can be applied.
	//
	// The type of the subtables must match Meta.LookupType, but the
	// subtables may use any format within that type.
	Subtables Subtables
}

LookupTable represents a lookup table inside a "GSUB" or "GPOS" table of a font. https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#lookup-table

type Match

type Match struct {
	InputPos []int // in increasing order
	Replace  []glyph.Info
	Actions  SeqLookups
	Next     int
}

Match describes the effect of applying a Lookup to a glyph sequence.

type PairAdjust

type PairAdjust struct {
	First, Second *GposValueRecord
}

PairAdjust represents information from a PairValueRecord table.

type ScriptListInfo

type ScriptListInfo map[language.Tag]*Features

ScriptListInfo contains the information of a ScriptList table. It maps BCP 47 tags to OpenType font features.

type SeqContext1

type SeqContext1 struct {
	Cov   coverage.Table
	Rules [][]*SeqRule // indexed by coverage index
}

SeqContext1 is used for GSUB type 5 format 1 subtables and GPOS type 7 format 1 subtables. https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#sequence-context-format-1-simple-glyph-contexts

func (*SeqContext1) Apply

func (l *SeqContext1) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*SeqContext1) Encode

func (l *SeqContext1) Encode() []byte

Encode implements the Subtable interface.

func (*SeqContext1) EncodeLen

func (l *SeqContext1) EncodeLen() int

EncodeLen implements the Subtable interface.

type SeqContext2

type SeqContext2 struct {
	Cov   coverage.Table
	Input classdef.Table
	Rules [][]*ClassSeqRule // indexed by class index of the first glyph
}

SeqContext2 is used for GSUB type 5 format 2 subtables and GPOS type 7 format 2 subtables. https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#sequence-context-format-2-class-based-glyph-contexts

func (*SeqContext2) Apply

func (l *SeqContext2) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*SeqContext2) Encode

func (l *SeqContext2) Encode() []byte

Encode implements the Subtable interface.

func (*SeqContext2) EncodeLen

func (l *SeqContext2) EncodeLen() int

EncodeLen implements the Subtable interface.

type SeqContext3

type SeqContext3 struct {
	Input   []coverage.Table
	Actions SeqLookups
}

SeqContext3 is used for GSUB type 5 format 3 and GPOS type 7 format 3 subtables. https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#sequence-context-format-3-coverage-based-glyph-contexts

func (*SeqContext3) Apply

func (l *SeqContext3) Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

Apply implements the Subtable interface.

func (*SeqContext3) Encode

func (l *SeqContext3) Encode() []byte

Encode implements the Subtable interface.

func (*SeqContext3) EncodeLen

func (l *SeqContext3) EncodeLen() int

EncodeLen implements the Subtable interface.

type SeqLookup

type SeqLookup struct {
	SequenceIndex   uint16
	LookupListIndex LookupIndex
}

SeqLookup describes the actions for contextual and chained contextual lookups.

type SeqLookups

type SeqLookups []SeqLookup

SeqLookups describes the actions of nested lookups.

type SeqRule

type SeqRule struct {
	Input   []glyph.ID // excludes the first input glyph, since this is in Cov
	Actions SeqLookups
}

SeqRule describes a rule in a SeqContext1 subtable.

type Subtable

type Subtable interface {
	// Apply attempts to apply the subtable at the given position.
	// If returns the new glyphs and the new position.  If the subtable
	// cannot be applied, the unchanged glyphs and a negative position
	// are returned
	//
	// This checks whether the Subtable can be applied to seq[a:b-1].
	// The function keep represents the lookup flags, glyphs for which
	// keep(seq[i].Gid) is false must be ignored.  The caller already
	// checks the glyph at location a, so only subsequent glyphs need to
	// be tested by the Subtable implementation.
	Apply(keep keepGlyphFn, seq []glyph.Info, a, b int) *Match

	EncodeLen() int

	Encode() []byte
}

Subtable represents a subtable of a "GSUB" or "GPOS" lookup table.

type Subtables

type Subtables []Subtable

Subtables is a slice of Subtable.

func (Subtables) Apply

func (ss Subtables) Apply(keep keepGlyphFn, seq []glyph.Info, pos, b int) *Match

Apply tries the subtables one by one and applies the first one that matches. If no subtable matches, the unchanged glyphs and a negative position are returned.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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