sdf

package module
v0.0.0-...-168179a Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CharMap

type CharMap struct {
	Start, Count, Offset int32
}

type Context

type Context struct {
	Reader io.ReadSeeker
	// for investigation
	Header StoreHeader

	Width, Height                      int
	BitmapListOffset, BitmapByteLength int64

	CharMaps    []CharMap
	InstrsCache map[rune]Instrs

	// config section
	AdvanceWidth int
}

func Create

func Create(reader io.ReadSeeker) (*Context, error)

func (*Context) FindRuneInstructions

func (ctx *Context) FindRuneInstructions(r rune) (Instrs, error)

func (*Context) ReadBytes

func (ctx *Context) ReadBytes(start int64, l int64) ([]byte, error)

func (*Context) RenderRune

func (ctx *Context) RenderRune(img draw.Image, r rune, fontSize int, pt image.Point, c color.Color) error

func (*Context) RenderText

func (ctx *Context) RenderText(img draw.Image, text string, fontSize int, pt image.Point, c color.Color)

type Instrs

type Instrs []image.Point

type RuneRange

type RuneRange struct {
	Start, End rune
}

type SerializerContext

type SerializerContext struct {
	Writer io.Writer

	Width, Height,
	CharMapByteLength, BitmapByteLength int

	CharMaps []CharMap

	CurrCharMapIndex, CurrBitmapIndex int
}

func CreateSerializer

func CreateSerializer(writer io.Writer, width, height int, runeRanges []RuneRange) (*SerializerContext, error)

func (*SerializerContext) NextCharMap

func (ctx *SerializerContext) NextCharMap() bool

func (*SerializerContext) WriteBitmapImage

func (ctx *SerializerContext) WriteBitmapImage(img image.Image) error

type StoreHeader

type StoreHeader struct {
	Magic         [4]byte
	Version       [2]uint8
	Flags         uint16
	Reserved      [2]byte
	Width, Height uint8
	CharMapListOffset, CharMapListCount,
	BitmapListOffset int32
}

Directories

Path Synopsis
cmd
mksdf command
sdfinfo command

Jump to

Keyboard shortcuts

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