Documentation
¶
Index ¶
- Constants
- func AppendByteDigits(value byte, str []byte) []byte
- func AppendShortString(buffer []byte, str string) []byte
- func AppendString(buffer []byte, str string) []byte
- func AppendUint16LE(buffer []byte, value uint16) []byte
- func AppendUint24LE(buffer []byte, value uint32) []byte
- func AppendUint32LE(buffer []byte, value uint32) []byte
- func AppendUint64LE(buffer []byte, value uint64) []byte
- func AppendUint8(buffer []byte, value byte) []byte
- func BadBinarySearch[T cmp.Ordered](slice []T, target T) (int, bool)
- func BasicOrderedNonRepeatInsert[T cmp.Ordered](buffer []T, element T) []T
- func BoolErrCheck(value uint8) error
- func BoolToUint8(truthy bool) uint8
- func CryptoRandUint64() (uint64, error)
- func DecodeDate(buffer []byte) (uint16, uint8, uint8)
- func DecodeUint16LE(buffer []byte) uint16
- func DecodeUint24LE(buffer []byte) uint32
- func DecodeUint32LE(buffer []byte) uint32
- func DecodeUint64LE(buffer []byte) uint64
- func DeleteElementAt[T any](buffer []T, index int) []T
- func EncodeUint16LE(buffer []byte, value uint16)
- func EncodeUint24LE(buffer []byte, value uint32)
- func EncodeUint32LE(buffer []byte, value uint32)
- func GrowSliceByN[T any](buffer []T, increase int) []T
- func GrowSliceByOne[T any](buffer []T) []T
- func LazyEntropyUint64(value uint64) float64
- func SetSliceSize[T any](buffer []T, size int) []T
- func ValidateBasicName(name string) error
- type BoolList
- func (self *BoolList) Get(i int) bool
- func (self *BoolList) GetU8(i uint8) bool
- func (self *BoolList) GetWordAndBitMaskU8(i uint8) (uint8, uint8)
- func (self *BoolList) IsSet(i int) bool
- func (self *BoolList) IsSetU8(i uint8) bool
- func (self *BoolList) IsUnset(i int) bool
- func (self *BoolList) IsUnsetU8(i uint8) bool
- func (self *BoolList) Push(value bool)
- func (self *BoolList) RawGetU8(word, bitMask uint8) bool
- func (self *BoolList) Set(i int, value bool)
- func (self *BoolList) SetAllFalse()
- func (self *BoolList) SetAllTrue()
- func (self *BoolList) SetU8(i uint8, value bool)
- type CircularBufferU16
- func (self *CircularBufferU16[T]) Capacity() uint16
- func (self *CircularBufferU16[T]) Clear()
- func (self *CircularBufferU16[T]) ConfirmPeeks()
- func (self *CircularBufferU16[T]) DiscardPeeks()
- func (self *CircularBufferU16[T]) Head() T
- func (self *CircularBufferU16[T]) IsEmpty() bool
- func (self *CircularBufferU16[T]) PeekAhead() (T, bool)
- func (self *CircularBufferU16[T]) PopHead() T
- func (self *CircularBufferU16[T]) PopTail() T
- func (self *CircularBufferU16[T]) Push(element T)
- func (self *CircularBufferU16[T]) SetCapacity(capacity uint16) bool
- func (self *CircularBufferU16[T]) SetMinCapacity(capacity uint16) bool
- func (self *CircularBufferU16[T]) Size() uint16
- func (self *CircularBufferU16[T]) Tail() T
- type Font
- type ParsingBuffer
- func (self *ParsingBuffer) AdvanceBytes(n int) error
- func (self *ParsingBuffer) AdvanceShortSlice() error
- func (self *ParsingBuffer) EnsureEOF() error
- func (self *ParsingBuffer) InitBuffers()
- func (self *ParsingBuffer) InitGzipReader(reader io.Reader) error
- func (self *ParsingBuffer) NewError(details string) error
- func (self *ParsingBuffer) ReadBool() (bool, error)
- func (self *ParsingBuffer) ReadInt32() (int32, error)
- func (self *ParsingBuffer) ReadInt8() (int8, error)
- func (self *ParsingBuffer) ReadShortStr() (string, error)
- func (self *ParsingBuffer) ReadString() (string, error)
- func (self *ParsingBuffer) ReadUint16() (uint16, error)
- func (self *ParsingBuffer) ReadUint24() (uint32, error)
- func (self *ParsingBuffer) ReadUint32() (uint32, error)
- func (self *ParsingBuffer) ReadUint64() (uint64, error)
- func (self *ParsingBuffer) ReadUint8() (uint8, error)
- func (self *ParsingBuffer) ValidateBasicName(name string) error
- func (self *ParsingBuffer) ValidateBasicSpacedName(name string) error
- type RawBlock
- type SingleInstancePool
Constants ¶
const BrokenCode = "brokenCode"
const FormatVersion = 0x0000_00002
const MappingConditionArg1Const = 0b0000_1000
const MappingConditionArg1RNG = 0b0000_0100
const MappingConditionArg1Var = 0b0000_0000
const MappingConditionArg2Const = 0b0000_1000
const MappingConditionArg2RNG = 0b0000_0100
const MappingConditionArg2Var = 0b0000_0000
const MappingConditionOpDiff = 0b0001_0000
const MappingConditionOpEqual = 0b0000_0000
these must definitely not be exposed to the public
const MappingConditionOpLE = 0b0011_0000
const MappingConditionOpLT = 0b0010_0000
const MaxFastMappingTableCodePoints = 1000
const MaxFastMappingTableCodePointsStr = "1000"
const MaxFastMappingTablesSize = (32 << 10)
some of these could be exposed to the public
const MaxFontDataSize = (32 << 20) // check both total file size and after uncompressing without signature
const MaxGlyphs = 56789
const MaxGlyphsPerCodePoint = 64
const MinEntropyID = 0.26
const MinGlyphReRuleFmtLen = 11
const MinUtf8ReRuleFmtLen = 13 // TODO: I don't know, actually
Variables ¶
This section is empty.
Functions ¶
func AppendByteDigits ¶
func AppendShortString ¶
func AppendString ¶
func AppendUint16LE ¶
func AppendUint24LE ¶
func AppendUint32LE ¶
func AppendUint64LE ¶
func AppendUint8 ¶
func BadBinarySearch ¶
Like slices.BinarySearch, but without NaN nor overflow support. And better variable names, seriously...
func BoolErrCheck ¶
func BoolToUint8 ¶
func CryptoRandUint64 ¶
func DecodeUint16LE ¶
func DecodeUint24LE ¶
func DecodeUint32LE ¶
func DecodeUint64LE ¶
func DeleteElementAt ¶
func EncodeUint16LE ¶
func EncodeUint24LE ¶
func EncodeUint32LE ¶
func GrowSliceByN ¶
func GrowSliceByOne ¶
func GrowSliceByOne[T any](buffer []T) []T
This method is only useful when T is a type that's either very large or it contains slices already allocated that we want to preserve and reuse. In those cases, GrowSliceByOne might help reduce GC and new allocations (it can also unnecessarily hog memory when misused).
func LazyEntropyUint64 ¶
Values <0.3 are fairly low entropy. anything <0.2 tends to be visibly low entropy
func SetSliceSize ¶
The contents might be cleared.
func ValidateBasicName ¶
Types ¶
type BoolList ¶
type BoolList struct {
// contains filtered or unexported fields
}
func NewBoolList ¶
func (*BoolList) GetWordAndBitMaskU8 ¶
func (*BoolList) SetAllFalse ¶
func (self *BoolList) SetAllFalse()
func (*BoolList) SetAllTrue ¶
func (self *BoolList) SetAllTrue()
type CircularBufferU16 ¶
type CircularBufferU16[T any] struct { // contains filtered or unexported fields }
func (*CircularBufferU16[T]) Capacity ¶
func (self *CircularBufferU16[T]) Capacity() uint16
func (*CircularBufferU16[T]) Clear ¶
func (self *CircularBufferU16[T]) Clear()
func (*CircularBufferU16[T]) ConfirmPeeks ¶
func (self *CircularBufferU16[T]) ConfirmPeeks()
func (*CircularBufferU16[T]) DiscardPeeks ¶
func (self *CircularBufferU16[T]) DiscardPeeks()
func (*CircularBufferU16[T]) Head ¶
func (self *CircularBufferU16[T]) Head() T
func (*CircularBufferU16[T]) IsEmpty ¶
func (self *CircularBufferU16[T]) IsEmpty() bool
func (*CircularBufferU16[T]) PeekAhead ¶
func (self *CircularBufferU16[T]) PeekAhead() (T, bool)
func (*CircularBufferU16[T]) PopHead ¶
func (self *CircularBufferU16[T]) PopHead() T
func (*CircularBufferU16[T]) PopTail ¶
func (self *CircularBufferU16[T]) PopTail() T
func (*CircularBufferU16[T]) Push ¶
func (self *CircularBufferU16[T]) Push(element T)
This method panics if we go above the current capacity.
func (*CircularBufferU16[T]) SetCapacity ¶
func (self *CircularBufferU16[T]) SetCapacity(capacity uint16) bool
Returns false if capacity < CircularBufferU16.Len().
func (*CircularBufferU16[T]) SetMinCapacity ¶
func (self *CircularBufferU16[T]) SetMinCapacity(capacity uint16) bool
func (*CircularBufferU16[T]) Size ¶
func (self *CircularBufferU16[T]) Size() uint16
func (*CircularBufferU16[T]) Tail ¶
func (self *CircularBufferU16[T]) Tail() T
type Font ¶
type Font struct { Data []byte // already ungzipped, starting from HEADER (signature is ignored) // offsets to specific points at which critical data appears // (offsetToHeader is always zero) OffsetToMetrics uint32 // OffsetToColorSections uint32 // OffsetToColorSectionNames uint32 OffsetToDyes uint32 OffsetToPalettes uint32 OffsetToGlyphNames uint32 OffsetToGlyphMasks uint32 OffsetToWords uint32 OffsetToSettingNames uint32 OffsetToSettingDefinitions uint32 OffsetToMappingSwitches uint32 OffsetToMapping uint32 OffsetToRewriteConditions uint32 OffsetToRewriteUtf8Sets uint32 OffsetToRewriteGlyphSets uint32 OffsetToUtf8Rewrites uint32 OffsetToGlyphRewrites uint32 OffsetToHorzKernings uint32 OffsetToVertKernings uint32 }
type ParsingBuffer ¶
type ParsingBuffer struct { TempBuff []byte // size 1024, for temporary reads immediately copied to 'bytes' FileType string Bytes []byte Index int // index of processed data within 'bytes'. unprocessed data == len(bytes) - index // contains filtered or unexported fields }
func (*ParsingBuffer) AdvanceBytes ¶
func (self *ParsingBuffer) AdvanceBytes(n int) error
func (*ParsingBuffer) AdvanceShortSlice ¶
func (self *ParsingBuffer) AdvanceShortSlice() error
func (*ParsingBuffer) EnsureEOF ¶
func (self *ParsingBuffer) EnsureEOF() error
func (*ParsingBuffer) InitBuffers ¶
func (self *ParsingBuffer) InitBuffers()
func (*ParsingBuffer) InitGzipReader ¶
func (self *ParsingBuffer) InitGzipReader(reader io.Reader) error
func (*ParsingBuffer) NewError ¶
func (self *ParsingBuffer) NewError(details string) error
func (*ParsingBuffer) ReadBool ¶
func (self *ParsingBuffer) ReadBool() (bool, error)
Returns bool value, new index, and an error if format was incorrect.
func (*ParsingBuffer) ReadInt32 ¶
func (self *ParsingBuffer) ReadInt32() (int32, error)
func (*ParsingBuffer) ReadInt8 ¶
func (self *ParsingBuffer) ReadInt8() (int8, error)
func (*ParsingBuffer) ReadShortStr ¶
func (self *ParsingBuffer) ReadShortStr() (string, error)
func (*ParsingBuffer) ReadString ¶
func (self *ParsingBuffer) ReadString() (string, error)
func (*ParsingBuffer) ReadUint16 ¶
func (self *ParsingBuffer) ReadUint16() (uint16, error)
func (*ParsingBuffer) ReadUint24 ¶
func (self *ParsingBuffer) ReadUint24() (uint32, error)
func (*ParsingBuffer) ReadUint32 ¶
func (self *ParsingBuffer) ReadUint32() (uint32, error)
func (*ParsingBuffer) ReadUint64 ¶
func (self *ParsingBuffer) ReadUint64() (uint64, error)
func (*ParsingBuffer) ReadUint8 ¶
func (self *ParsingBuffer) ReadUint8() (uint8, error)
func (*ParsingBuffer) ValidateBasicName ¶
func (self *ParsingBuffer) ValidateBasicName(name string) error
func (*ParsingBuffer) ValidateBasicSpacedName ¶
func (self *ParsingBuffer) ValidateBasicSpacedName(name string) error
Repeated spaces and hyphens and stuff are ok on basic names.
type RawBlock ¶
type RawBlock struct{ Data []uint8 }
Internal base type for [ggfnt.GlyphRewriteRule], [ggfnt.Utf8RewriteRule], [ggfnt.GlyphRewriteSet], [ggfnt.Utf8RewriteSet], etc.
type SingleInstancePool ¶
type SingleInstancePool[T any] struct { // contains filtered or unexported fields }
Kind of a single-element pool. Basically, it instances one element and associates it to a lock. If we request more elements of that type, we are creating new ones instead. This means that non-concurrent operation can reuse an element, and concurrent access is not expected nor desirable, but not technically incorrect (only potentially inefficient).
func (*SingleInstancePool[T]) Release ¶
func (self *SingleInstancePool[T]) Release(instance *T)
func (*SingleInstancePool[T]) Retrieve ¶
func (self *SingleInstancePool[T]) Retrieve() *T