Documentation
¶
Index ¶
- Constants
- func GetPredefinedWord(i uint8) string
- type AnimationFlags
- type Date
- type DyeKey
- type FmtValidation
- type Font
- func (self *Font) Color() *FontColor
- func (self *Font) Export(writer io.Writer) error
- func (self *Font) Glyphs() *FontGlyphs
- func (self *Font) Header() *FontHeader
- func (self *Font) Kerning() *FontKerning
- func (self *Font) Mapping() *FontMapping
- func (self *Font) Metrics() *FontMetrics
- func (self *Font) RawSize() int
- func (self *Font) Rewrites() *FontRewrites
- func (self *Font) Settings() *FontSettings
- func (self *Font) Validate(mode FmtValidation) error
- type FontColor
- func (self *FontColor) Count() uint8
- func (self *FontColor) EachDye(fn func(DyeKey, string))
- func (self *FontColor) EachDyeAlpha(key DyeKey, fn func(uint8))
- func (self *FontColor) EachPalette(fn func(PaletteKey, string))
- func (self *FontColor) EachPaletteColor(key PaletteKey, fn func(color.RGBA))
- func (self *FontColor) GoColorPalette() color.Palette
- func (self *FontColor) NumDyeAlphas(key DyeKey) uint8
- func (self *FontColor) NumDyeIndices() uint8
- func (self *FontColor) NumDyes() uint8
- func (self *FontColor) NumPaletteColors(key PaletteKey) uint8
- func (self *FontColor) NumPaletteIndices() uint8
- func (self *FontColor) NumPalettes() uint8
- func (self *FontColor) Validate(mode FmtValidation) error
- type FontGlyphs
- func (self *FontGlyphs) Advance(glyphIndex GlyphIndex) uint8
- func (self *FontGlyphs) Count() uint16
- func (self *FontGlyphs) FindIndexByName(name string) GlyphIndex
- func (self *FontGlyphs) NamedCount() uint16
- func (self *FontGlyphs) Placement(glyphIndex GlyphIndex) GlyphPlacement
- func (self *FontGlyphs) RasterizeMask(glyphIndex GlyphIndex) *image.Alpha
- func (self *FontGlyphs) Validate(mode FmtValidation) error
- type FontHeader
- func (self *FontHeader) About() string
- func (self *FontHeader) Author() string
- func (self *FontHeader) Family() string
- func (self *FontHeader) FirstVersionDate() Date
- func (self *FontHeader) FormatVersion() uint32
- func (self *FontHeader) ID() uint64
- func (self *FontHeader) MajorVersionDate() Date
- func (self *FontHeader) MinorVersionDate() Date
- func (self *FontHeader) Name() string
- func (self *FontHeader) Validate(mode FmtValidation) error
- func (self *FontHeader) VersionMajor() uint16
- func (self *FontHeader) VersionMinor() uint16
- type FontKerning
- func (self *FontKerning) EachPair(func(prev, curr GlyphIndex, kern int8))
- func (self *FontKerning) EachVertPair(func(prev, curr GlyphIndex, kern int8))
- func (self *FontKerning) Get(prev, curr GlyphIndex) int8
- func (self *FontKerning) GetVert(prev, curr GlyphIndex) int8
- func (self *FontKerning) NumPairs() uint32
- func (self *FontKerning) NumVertPairs() uint32
- func (self *FontKerning) Validate(mode FmtValidation) error
- type FontMapping
- func (self *FontMapping) Ascii(codePoint byte, settings []uint8) (GlyphMappingGroup, bool)
- func (self *FontMapping) EvaluateSwitch(switchKey uint8, settings []uint8) uint8
- func (self *FontMapping) NumEntries() uint16
- func (self *FontMapping) NumSwitchTypes() uint8
- func (self *FontMapping) Utf8(codePoint rune, settings []uint8) (GlyphMappingGroup, bool)
- func (self *FontMapping) Utf8WithCache(codePoint rune, settingsCache *SettingsCache) (GlyphMappingGroup, bool)
- func (self *FontMapping) Validate(mode FmtValidation) error
- type FontMetrics
- func (self *FontMetrics) Ascent() uint8
- func (self *FontMetrics) Descent() uint8
- func (self *FontMetrics) ExtraAscent() uint8
- func (self *FontMetrics) ExtraDescent() uint8
- func (self *FontMetrics) HasVertLayout() bool
- func (self *FontMetrics) HorzInterspacing() uint8
- func (self *FontMetrics) LineGap() uint8
- func (self *FontMetrics) LineHeight() int
- func (self *FontMetrics) MidlineAscent() uint8
- func (self *FontMetrics) MonoWidth() uint8
- func (self *FontMetrics) Monospaced() bool
- func (self *FontMetrics) NumGlyphs() uint16
- func (self *FontMetrics) UppercaseAscent() uint8
- func (self *FontMetrics) Validate(mode FmtValidation) error
- func (self *FontMetrics) VertInterspacing() uint8
- func (self *FontMetrics) VertLineFullWidth() int
- func (self *FontMetrics) VertLineGap() uint8
- func (self *FontMetrics) VertLineWidth() uint8
- type FontRewrites
- func (self *FontRewrites) EvaluateCondition(conditionKey uint8, settings []uint8) bool
- func (self *FontRewrites) GetGlyphRule(index uint16) GlyphRewriteRule
- func (self *FontRewrites) GetGlyphSet(set uint8) GlyphRewriteSet
- func (self *FontRewrites) GetUtf8Rule(index uint16) Utf8RewriteRule
- func (self *FontRewrites) GetUtf8Set(set uint8) Utf8RewriteSet
- func (self *FontRewrites) NumConditions() uint8
- func (self *FontRewrites) NumGlyphRules() uint16
- func (self *FontRewrites) NumGlyphSets() uint8
- func (self *FontRewrites) NumUTF8Rules() uint16
- func (self *FontRewrites) NumUTF8Sets() uint8
- func (self *FontRewrites) Validate(mode FmtValidation) error
- type FontSettings
- func (self *FontSettings) Count() uint8
- func (self *FontSettings) Each(fn func(key SettingKey, name string))
- func (self *FontSettings) EachOption(key SettingKey, each func(optionIndex uint8, optionName string))
- func (self *FontSettings) GetNumOptions(key SettingKey) uint8
- func (self *FontSettings) GetOptionName(key SettingKey, option uint8) string
- func (self *FontSettings) GetWord(index uint8) string
- func (self *FontSettings) NumWords() uint8
- func (self *FontSettings) Validate(mode FmtValidation) error
- type GlyphIndex
- type GlyphMappingGroup
- type GlyphPlacement
- type GlyphRange
- type GlyphRewriteRule
- func (self *GlyphRewriteRule) BodyLen() uint8
- func (self *GlyphRewriteRule) Condition() uint8
- func (self *GlyphRewriteRule) EachOut(each func(GlyphIndex))
- func (self *GlyphRewriteRule) Equals(other GlyphRewriteRule) bool
- func (self *GlyphRewriteRule) HeadLen() uint8
- func (self *GlyphRewriteRule) InLen() uint8
- func (self *GlyphRewriteRule) OutLen() uint8
- func (self *GlyphRewriteRule) TailLen() uint8
- type GlyphRewriteSet
- type MappingCache
- type PaletteKey
- type SettingKey
- type SettingsCache
- func (self *SettingsCache) CacheMappingCase(switchTypeIndex uint8, result uint8)
- func (self *SettingsCache) CacheRewriteCondition(conditionIndex uint8, satisfied bool)
- func (self *SettingsCache) Get(key SettingKey) uint8
- func (self *SettingsCache) GetMappingCase(switchTypeIndex uint8) (uint8, bool)
- func (self *SettingsCache) GetRewriteCondition(conditionIndex uint8) (bool, bool)
- func (self *SettingsCache) Set(key SettingKey, option uint8) (mappingsAffected, rewriteConditionsAffected bool)
- func (self *SettingsCache) UnsafeSlice() []uint8
- type Utf8RewriteRule
- func (self *Utf8RewriteRule) BodyLen() uint8
- func (self *Utf8RewriteRule) Condition() uint8
- func (self *Utf8RewriteRule) EachOut(each func(rune))
- func (self *Utf8RewriteRule) Equals(other Utf8RewriteRule) bool
- func (self *Utf8RewriteRule) HeadLen() uint8
- func (self *Utf8RewriteRule) InLen() uint8
- func (self *Utf8RewriteRule) OutLen() uint8
- func (self *Utf8RewriteRule) String() string
- func (self *Utf8RewriteRule) TailLen() uint8
- type Utf8RewriteSet
Constants ¶
const FormatVersion = internal.FormatVersion
const MaxFontDataSize = internal.MaxFontDataSize // check both total file size and after uncompressing without signature
const MaxGlyphs = internal.MaxGlyphs
Variables ¶
This section is empty.
Functions ¶
func GetPredefinedWord ¶
Types ¶
type AnimationFlags ¶
type AnimationFlags uint8
const ( AnimFlagLoopable AnimationFlags = 0b0000_0001 // can wrap back to start after reaching the end AnimFlagSequential AnimationFlags = 0b0000_0010 // should play from start to finish in order, or the reverse AnimFlagTerminal AnimationFlags = 0b0000_0100 // animation shouldn't be rewinded/replayed automatically AnimFlagSplit AnimationFlags = 0b0000_1000 // frames are independent and we can stop/rest at any of them AnimFlagsGroupMask AnimationFlags = 0b1111_0000 // usage still undefined. maybe better leave as custom use flags? )
type Date ¶
func CurrentDate ¶
func CurrentDate() Date
func (*Date) IsComplete ¶
Returns true only when neither year, month nor day are missing.
type DyeKey ¶
type DyeKey uint8
Dyes are part of the font coloring. See FontColor for more details.
Dye keys go from 0 to FontColor.NumDyes() - 1, so they can be used directly for slice indexing if necessary.
type FmtValidation ¶
type FmtValidation bool
TODO: don't worry about this until actually implementing validation, I'll
see there how easy it is to make, and what might or might not be reasonable
const ( FmtDefault FmtValidation = false // basic and inexpensive checks only FmtStrict FmtValidation = true // check everything that can be checked )
type Font ¶
A Font is a read-only object that contains all the data required to use a font. To create a Font, we use the Parse() method.
Fonts contain multiple sections or tables, which are exposed through gateway methods and differentiated types:
- Use Font.Header() to access information about the FontHeader.
- Use Font.Metrics() to access information about the FontMetrics.
- Use Font.Glyphs() to access information about the FontGlyphs.
- Use Font.Color() to access information about the FontColor.
- Use Font.Settings() to access information about the FontSettings.
- Use Font.Mapping() to access information about the FontMapping.
- Use Font.Kerning() to access information about the FontKerning.
func ParseFromFS ¶
Utility method for parsing from a fs.FS, like when using embed.
func ParseFromPath ¶
Utility method for parsing a local font file directly from its path.
func (*Font) Glyphs ¶
func (self *Font) Glyphs() *FontGlyphs
func (*Font) Header ¶
func (self *Font) Header() *FontHeader
func (*Font) Kerning ¶
func (self *Font) Kerning() *FontKerning
func (*Font) Mapping ¶
func (self *Font) Mapping() *FontMapping
func (*Font) Metrics ¶
func (self *Font) Metrics() *FontMetrics
func (*Font) Rewrites ¶
func (self *Font) Rewrites() *FontRewrites
func (*Font) Settings ¶
func (self *Font) Settings() *FontSettings
func (*Font) Validate ¶
func (self *Font) Validate(mode FmtValidation) error
type FontColor ¶
type FontColor Font
func (*FontColor) EachDyeAlpha ¶
func (*FontColor) EachPalette ¶
func (self *FontColor) EachPalette(fn func(PaletteKey, string))
func (*FontColor) EachPaletteColor ¶
func (self *FontColor) EachPaletteColor(key PaletteKey, fn func(color.RGBA))
func (*FontColor) GoColorPalette ¶
func (*FontColor) NumDyeAlphas ¶
func (*FontColor) NumDyeIndices ¶
This is not FontColor.NumDyes(), but the total number of alpha values for each dye, the total number of font color indices taken by the dyes.
func (*FontColor) NumPaletteColors ¶
func (self *FontColor) NumPaletteColors(key PaletteKey) uint8
func (*FontColor) NumPaletteIndices ¶
This is not FontColor.NumPalettes(), but the total number of color values for each palette, the total number of font color indices taken by the palettes.
func (*FontColor) NumPalettes ¶
func (*FontColor) Validate ¶
func (self *FontColor) Validate(mode FmtValidation) error
type FontGlyphs ¶
type FontGlyphs Font
func (*FontGlyphs) Advance ¶
func (self *FontGlyphs) Advance(glyphIndex GlyphIndex) uint8
func (*FontGlyphs) Count ¶
func (self *FontGlyphs) Count() uint16
Same as FontMetrics.NumGlyphs() (it actually refers to the data in the font metrics section).
func (*FontGlyphs) FindIndexByName ¶
func (self *FontGlyphs) FindIndexByName(name string) GlyphIndex
If not found, the return value will be GlyphMissing.
func (*FontGlyphs) NamedCount ¶
func (self *FontGlyphs) NamedCount() uint16
func (*FontGlyphs) Placement ¶
func (self *FontGlyphs) Placement(glyphIndex GlyphIndex) GlyphPlacement
func (*FontGlyphs) RasterizeMask ¶
func (self *FontGlyphs) RasterizeMask(glyphIndex GlyphIndex) *image.Alpha
func (*FontGlyphs) Validate ¶
func (self *FontGlyphs) Validate(mode FmtValidation) error
type FontHeader ¶
type FontHeader Font
func (*FontHeader) About ¶
func (self *FontHeader) About() string
func (*FontHeader) Author ¶
func (self *FontHeader) Author() string
func (*FontHeader) Family ¶
func (self *FontHeader) Family() string
func (*FontHeader) FirstVersionDate ¶
func (self *FontHeader) FirstVersionDate() Date
func (*FontHeader) FormatVersion ¶
func (self *FontHeader) FormatVersion() uint32
func (*FontHeader) ID ¶
func (self *FontHeader) ID() uint64
func (*FontHeader) MajorVersionDate ¶
func (self *FontHeader) MajorVersionDate() Date
func (*FontHeader) MinorVersionDate ¶
func (self *FontHeader) MinorVersionDate() Date
func (*FontHeader) Name ¶
func (self *FontHeader) Name() string
func (*FontHeader) Validate ¶
func (self *FontHeader) Validate(mode FmtValidation) error
func (*FontHeader) VersionMajor ¶
func (self *FontHeader) VersionMajor() uint16
func (*FontHeader) VersionMinor ¶
func (self *FontHeader) VersionMinor() uint16
type FontKerning ¶
type FontKerning Font
func (*FontKerning) EachPair ¶
func (self *FontKerning) EachPair(func(prev, curr GlyphIndex, kern int8))
func (*FontKerning) EachVertPair ¶
func (self *FontKerning) EachVertPair(func(prev, curr GlyphIndex, kern int8))
func (*FontKerning) Get ¶
func (self *FontKerning) Get(prev, curr GlyphIndex) int8
func (*FontKerning) GetVert ¶
func (self *FontKerning) GetVert(prev, curr GlyphIndex) int8
func (*FontKerning) NumPairs ¶
func (self *FontKerning) NumPairs() uint32
func (*FontKerning) NumVertPairs ¶
func (self *FontKerning) NumVertPairs() uint32
func (*FontKerning) Validate ¶
func (self *FontKerning) Validate(mode FmtValidation) error
type FontMapping ¶
type FontMapping Font
func (*FontMapping) Ascii ¶
func (self *FontMapping) Ascii(codePoint byte, settings []uint8) (GlyphMappingGroup, bool)
func (*FontMapping) EvaluateSwitch ¶
func (self *FontMapping) EvaluateSwitch(switchKey uint8, settings []uint8) uint8
func (*FontMapping) NumEntries ¶
func (self *FontMapping) NumEntries() uint16
func (*FontMapping) NumSwitchTypes ¶
func (self *FontMapping) NumSwitchTypes() uint8
More than this might be needed for more complex switch caches, but it might not even be relevant, maybe the default cache is ok, without any interface at all.
func (*FontMapping) Utf8 ¶
func (self *FontMapping) Utf8(codePoint rune, settings []uint8) (GlyphMappingGroup, bool)
Notice: line breaks and other control codes shouldn't be requested here, but manually taken into account by the caller instead.
func (*FontMapping) Utf8WithCache ¶
func (self *FontMapping) Utf8WithCache(codePoint rune, settingsCache *SettingsCache) (GlyphMappingGroup, bool)
func (*FontMapping) Validate ¶
func (self *FontMapping) Validate(mode FmtValidation) error
type FontMetrics ¶
type FontMetrics Font
func (*FontMetrics) Ascent ¶
func (self *FontMetrics) Ascent() uint8
func (*FontMetrics) Descent ¶
func (self *FontMetrics) Descent() uint8
func (*FontMetrics) ExtraAscent ¶
func (self *FontMetrics) ExtraAscent() uint8
func (*FontMetrics) ExtraDescent ¶
func (self *FontMetrics) ExtraDescent() uint8
func (*FontMetrics) HasVertLayout ¶
func (self *FontMetrics) HasVertLayout() bool
func (*FontMetrics) HorzInterspacing ¶
func (self *FontMetrics) HorzInterspacing() uint8
func (*FontMetrics) LineGap ¶
func (self *FontMetrics) LineGap() uint8
func (*FontMetrics) LineHeight ¶
func (self *FontMetrics) LineHeight() int
Utility method returning the ascent + descent + line gap.
func (*FontMetrics) MidlineAscent ¶
func (self *FontMetrics) MidlineAscent() uint8
func (*FontMetrics) MonoWidth ¶
func (self *FontMetrics) MonoWidth() uint8
func (*FontMetrics) Monospaced ¶
func (self *FontMetrics) Monospaced() bool
func (*FontMetrics) NumGlyphs ¶
func (self *FontMetrics) NumGlyphs() uint16
func (*FontMetrics) UppercaseAscent ¶
func (self *FontMetrics) UppercaseAscent() uint8
func (*FontMetrics) Validate ¶
func (self *FontMetrics) Validate(mode FmtValidation) error
func (*FontMetrics) VertInterspacing ¶
func (self *FontMetrics) VertInterspacing() uint8
func (*FontMetrics) VertLineFullWidth ¶
func (self *FontMetrics) VertLineFullWidth() int
func (*FontMetrics) VertLineGap ¶
func (self *FontMetrics) VertLineGap() uint8
func (*FontMetrics) VertLineWidth ¶
func (self *FontMetrics) VertLineWidth() uint8
Notice: doesn't include FontMetrics.VertLineGap(). See FontMetrics.VertLineFullWidth().
type FontRewrites ¶
type FontRewrites Font
func (*FontRewrites) EvaluateCondition ¶
func (self *FontRewrites) EvaluateCondition(conditionKey uint8, settings []uint8) bool
func (*FontRewrites) GetGlyphRule ¶
func (self *FontRewrites) GetGlyphRule(index uint16) GlyphRewriteRule
func (*FontRewrites) GetGlyphSet ¶
func (self *FontRewrites) GetGlyphSet(set uint8) GlyphRewriteSet
func (*FontRewrites) GetUtf8Rule ¶
func (self *FontRewrites) GetUtf8Rule(index uint16) Utf8RewriteRule
func (*FontRewrites) GetUtf8Set ¶
func (self *FontRewrites) GetUtf8Set(set uint8) Utf8RewriteSet
func (*FontRewrites) NumConditions ¶
func (self *FontRewrites) NumConditions() uint8
func (*FontRewrites) NumGlyphRules ¶
func (self *FontRewrites) NumGlyphRules() uint16
func (*FontRewrites) NumGlyphSets ¶
func (self *FontRewrites) NumGlyphSets() uint8
func (*FontRewrites) NumUTF8Rules ¶
func (self *FontRewrites) NumUTF8Rules() uint16
func (*FontRewrites) NumUTF8Sets ¶
func (self *FontRewrites) NumUTF8Sets() uint8
func (*FontRewrites) Validate ¶
func (self *FontRewrites) Validate(mode FmtValidation) error
type FontSettings ¶
type FontSettings Font
Obtained through Font.Settings().
Settings can't be modified on the *Font object itself, that kind of state must be managed by a renderer or similar.
func (*FontSettings) Count ¶
func (self *FontSettings) Count() uint8
func (*FontSettings) Each ¶
func (self *FontSettings) Each(fn func(key SettingKey, name string))
func (*FontSettings) EachOption ¶
func (self *FontSettings) EachOption(key SettingKey, each func(optionIndex uint8, optionName string))
func (*FontSettings) GetNumOptions ¶
func (self *FontSettings) GetNumOptions(key SettingKey) uint8
func (self *FontSettings) FindKeyByName(name string) SettingKey { panic("unimplemented") } func (self *FontSettings) GetInitValue(key SettingKey) uint8 { panic("unimplemented") }
func (*FontSettings) GetOptionName ¶
func (self *FontSettings) GetOptionName(key SettingKey, option uint8) string
func (*FontSettings) GetWord ¶
func (self *FontSettings) GetWord(index uint8) string
func (*FontSettings) NumWords ¶
func (self *FontSettings) NumWords() uint8
func (*FontSettings) Validate ¶
func (self *FontSettings) Validate(mode FmtValidation) error
type GlyphIndex ¶
type GlyphIndex uint16
const ( GlyphMissing GlyphIndex = 56789 GlyphZilch GlyphIndex = 56790 GlyphNewLine GlyphIndex = 56791 GlyphCustomMin GlyphIndex = 60000 GlyphCustomMax GlyphIndex = 62000 )
type GlyphMappingGroup ¶
type GlyphMappingGroup struct {
// contains filtered or unexported fields
}
Returned from FontMapping.Utf8().
func (*GlyphMappingGroup) AnimationFlags ¶
func (self *GlyphMappingGroup) AnimationFlags() AnimationFlags
func (*GlyphMappingGroup) CaseBranch ¶
func (self *GlyphMappingGroup) CaseBranch() uint8
func (*GlyphMappingGroup) Select ¶
func (self *GlyphMappingGroup) Select(choice uint8) GlyphIndex
Precondition: choice must be between 0 and GlyphMappingGroup.Size() - 1
func (*GlyphMappingGroup) Size ¶
func (self *GlyphMappingGroup) Size() uint8
type GlyphPlacement ¶
type GlyphRange ¶
type GlyphRange struct {
First GlyphIndex // included
Last GlyphIndex // included
}
func NewRange ¶
func NewRange(first, last GlyphIndex) GlyphRange
func (*GlyphRange) Contains ¶
func (self *GlyphRange) Contains(index GlyphIndex) bool
func (*GlyphRange) Validate ¶
func (self *GlyphRange) Validate(maxGlyphs uint16) error
type GlyphRewriteRule ¶
func (*GlyphRewriteRule) BodyLen ¶
func (self *GlyphRewriteRule) BodyLen() uint8
func (*GlyphRewriteRule) Condition ¶
func (self *GlyphRewriteRule) Condition() uint8
TODO: a validation method would be nice
func (*GlyphRewriteRule) EachOut ¶
func (self *GlyphRewriteRule) EachOut(each func(GlyphIndex))
func (*GlyphRewriteRule) Equals ¶
func (self *GlyphRewriteRule) Equals(other GlyphRewriteRule) bool
func (*GlyphRewriteRule) HeadLen ¶
func (self *GlyphRewriteRule) HeadLen() uint8
func (*GlyphRewriteRule) InLen ¶
func (self *GlyphRewriteRule) InLen() uint8
func (*GlyphRewriteRule) OutLen ¶
func (self *GlyphRewriteRule) OutLen() uint8
func (*GlyphRewriteRule) TailLen ¶
func (self *GlyphRewriteRule) TailLen() uint8
type GlyphRewriteSet ¶
func (*GlyphRewriteSet) EachListGlyph ¶
func (self *GlyphRewriteSet) EachListGlyph(each func(GlyphIndex) error) error
func (*GlyphRewriteSet) EachRange ¶
func (self *GlyphRewriteSet) EachRange(each func(GlyphRange) error) error
type MappingCache ¶
type MappingCache struct {
// contains filtered or unexported fields
}
Glyph mapping cache. These are recommended to be used at small sizes, like 192. In general, a glyph mapping cache is not even critical for operation unless the font has multiple settings affecting mapping, animations and so on. In those cases, the mapping can get more expensive, and using a mapping cache can be beneficial.
func NewMappingCache ¶
func NewMappingCache(font *Font, size int) *MappingCache
The size is statically allocated.
func (*MappingCache) Drop ¶
func (self *MappingCache) Drop()
Drops must be manually requested due to variable changes.
func (*MappingCache) Get ¶
func (self *MappingCache) Get(codePoint rune, settings *SettingsCache) (GlyphMappingGroup, bool)
Returned bool will be false if not found.
func (*MappingCache) Reset ¶
func (self *MappingCache) Reset(font *Font)
Resets the mapping cache completely, with only the size being preserved.
type PaletteKey ¶
type PaletteKey uint8
Palettes are part of the font coloring. See FontColor for more details.
Palette keys go from 0 to FontColor.NumPalettes() - 1, so they can be used directly for slice indexing if necessary.
type SettingsCache ¶
type SettingsCache struct {
// contains filtered or unexported fields
}
func NewSettingsCache ¶
func NewSettingsCache(font *Font) *SettingsCache
func (*SettingsCache) CacheMappingCase ¶
func (self *SettingsCache) CacheMappingCase(switchTypeIndex uint8, result uint8)
func (*SettingsCache) CacheRewriteCondition ¶
func (self *SettingsCache) CacheRewriteCondition(conditionIndex uint8, satisfied bool)
func (*SettingsCache) Get ¶
func (self *SettingsCache) Get(key SettingKey) uint8
func (*SettingsCache) GetMappingCase ¶
func (self *SettingsCache) GetMappingCase(switchTypeIndex uint8) (uint8, bool)
First uint8 is the case value, second bool is case being cached or not. If not cached, the first result must be ignored.
func (*SettingsCache) GetRewriteCondition ¶
func (self *SettingsCache) GetRewriteCondition(conditionIndex uint8) (bool, bool)
First bool is the condition being satisfied or not. Second bool is condition being cached or not. If not cached, the first result must be ignored.
func (*SettingsCache) Set ¶
func (self *SettingsCache) Set(key SettingKey, option uint8) (mappingsAffected, rewriteConditionsAffected bool)
Returns two bools for mappings and rewrite conditions affected.
func (*SettingsCache) UnsafeSlice ¶
func (self *SettingsCache) UnsafeSlice() []uint8
TODO: read only, might remove later.
type Utf8RewriteRule ¶
func (*Utf8RewriteRule) BodyLen ¶
func (self *Utf8RewriteRule) BodyLen() uint8
func (*Utf8RewriteRule) Condition ¶
func (self *Utf8RewriteRule) Condition() uint8
func (*Utf8RewriteRule) EachOut ¶
func (self *Utf8RewriteRule) EachOut(each func(rune))
func (*Utf8RewriteRule) Equals ¶
func (self *Utf8RewriteRule) Equals(other Utf8RewriteRule) bool
func (*Utf8RewriteRule) HeadLen ¶
func (self *Utf8RewriteRule) HeadLen() uint8
func (*Utf8RewriteRule) InLen ¶
func (self *Utf8RewriteRule) InLen() uint8
func (*Utf8RewriteRule) OutLen ¶
func (self *Utf8RewriteRule) OutLen() uint8
func (*Utf8RewriteRule) String ¶
func (self *Utf8RewriteRule) String() string
func (*Utf8RewriteRule) TailLen ¶
func (self *Utf8RewriteRule) TailLen() uint8
type Utf8RewriteSet ¶
func (*Utf8RewriteSet) EachListRune ¶
func (self *Utf8RewriteSet) EachListRune(each func(rune) error) error