internal

package
v0.0.0-...-6ad6dc7 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const BrokenCode = "brokenCode"
View Source
const FormatVersion = 0x0000_00002
View Source
const MappingConditionArg1Const = 0b0000_1000
View Source
const MappingConditionArg1RNG = 0b0000_0100
View Source
const MappingConditionArg1Var = 0b0000_0000
View Source
const MappingConditionArg2Const = 0b0000_1000
View Source
const MappingConditionArg2RNG = 0b0000_0100
View Source
const MappingConditionArg2Var = 0b0000_0000
View Source
const MappingConditionOpDiff = 0b0001_0000
View Source
const MappingConditionOpEqual = 0b0000_0000

these must definitely not be exposed to the public

View Source
const MappingConditionOpLE = 0b0011_0000
View Source
const MappingConditionOpLT = 0b0010_0000
View Source
const MaxFastMappingTableCodePoints = 1000
View Source
const MaxFastMappingTableCodePointsStr = "1000"
View Source
const MaxFastMappingTablesSize = (32 << 10)

some of these could be exposed to the public

View Source
const MaxFontDataSize = (32 << 20) // check both total file size and after uncompressing without signature
View Source
const MaxGlyphs = 56789
View Source
const MaxGlyphsPerCodePoint = 64
View Source
const MinEntropyID = 0.26
View Source
const MinGlyphReRuleFmtLen = 11
View Source
const MinUtf8ReRuleFmtLen = 13 // TODO: I don't know, actually

Variables

This section is empty.

Functions

func AppendByteDigits

func AppendByteDigits(value byte, str []byte) []byte

func AppendShortString

func AppendShortString(buffer []byte, str string) []byte

func AppendString

func AppendString(buffer []byte, str string) []byte

func AppendUint16LE

func AppendUint16LE(buffer []byte, value uint16) []byte

func AppendUint24LE

func AppendUint24LE(buffer []byte, value uint32) []byte

func AppendUint32LE

func AppendUint32LE(buffer []byte, value uint32) []byte

func AppendUint64LE

func AppendUint64LE(buffer []byte, value uint64) []byte

func AppendUint8

func AppendUint8(buffer []byte, value byte) []byte

func BadBinarySearch

func BadBinarySearch[T cmp.Ordered](slice []T, target T) (int, bool)

Like slices.BinarySearch, but without NaN nor overflow support. And better variable names, seriously...

func BasicOrderedNonRepeatInsert

func BasicOrderedNonRepeatInsert[T cmp.Ordered](buffer []T, element T) []T

func BoolErrCheck

func BoolErrCheck(value uint8) error

func BoolToUint8

func BoolToUint8(truthy bool) uint8

func CryptoRandUint64

func CryptoRandUint64() (uint64, error)

func DecodeDate

func DecodeDate(buffer []byte) (uint16, uint8, uint8)

func DecodeUint16LE

func DecodeUint16LE(buffer []byte) uint16

func DecodeUint24LE

func DecodeUint24LE(buffer []byte) uint32

func DecodeUint32LE

func DecodeUint32LE(buffer []byte) uint32

func DecodeUint64LE

func DecodeUint64LE(buffer []byte) uint64

func DeleteElementAt

func DeleteElementAt[T any](buffer []T, index int) []T

func EncodeUint16LE

func EncodeUint16LE(buffer []byte, value uint16)

func EncodeUint24LE

func EncodeUint24LE(buffer []byte, value uint32)

func EncodeUint32LE

func EncodeUint32LE(buffer []byte, value uint32)

func GrowSliceByN

func GrowSliceByN[T any](buffer []T, increase int) []T

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

func LazyEntropyUint64(value uint64) float64

Values <0.3 are fairly low entropy. anything <0.2 tends to be visibly low entropy

func SetSliceSize

func SetSliceSize[T any](buffer []T, size int) []T

The contents might be cleared.

func ValidateBasicName

func ValidateBasicName(name string) error

Types

type BoolList

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

func NewBoolList

func NewBoolList(size int) BoolList

func (*BoolList) Get

func (self *BoolList) Get(i int) bool

func (*BoolList) GetU8

func (self *BoolList) GetU8(i uint8) bool

func (*BoolList) GetWordAndBitMaskU8

func (self *BoolList) GetWordAndBitMaskU8(i uint8) (uint8, uint8)

func (*BoolList) IsSet

func (self *BoolList) IsSet(i int) bool

func (*BoolList) IsSetU8

func (self *BoolList) IsSetU8(i uint8) bool

func (*BoolList) IsUnset

func (self *BoolList) IsUnset(i int) bool

func (*BoolList) IsUnsetU8

func (self *BoolList) IsUnsetU8(i uint8) bool

func (*BoolList) Push

func (self *BoolList) Push(value bool)

func (*BoolList) RawGetU8

func (self *BoolList) RawGetU8(word, bitMask uint8) bool

func (*BoolList) Set

func (self *BoolList) Set(i int, value bool)

func (*BoolList) SetAllFalse

func (self *BoolList) SetAllFalse()

func (*BoolList) SetAllTrue

func (self *BoolList) SetAllTrue()

func (*BoolList) SetU8

func (self *BoolList) SetU8(i uint8, value bool)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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