fontutil

package
v1.3.13 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CarriageReturnRune = '␍' // C/R symbol: '␍'; old: '♪'
View Source
var DefaultFaceOptions = NewFaceOptions(12, 72)
View Source
var FontsMan = NewFontsManager()
View Source
var TabWidth = 8 // n times the space glyph

Functions

func Fixed266ToFloat64

func Fixed266ToFloat64(v fixed.Int26_6) float64

func Float32ToFixed266

func Float32ToFixed266(v float32) fixed.Int26_6

func Float64ToFixed266

func Float64ToFixed266(v float64) fixed.Int26_6

func NewFallbackFaces added in v1.3.13

func NewFallbackFaces(fallbackFont *Font, fopts FaceOptions) []font.Face

func NewKernCache

func NewKernCache(face font.Face, r0, r1 rune) fixed.Int26_6

func Rect266MinFloorMaxCeil

func Rect266MinFloorMaxCeil(r fixed.Rectangle26_6) image.Rectangle

Types

type FaceCache

type FaceCache struct {
	font.Face
	// contains filtered or unexported fields
}

func NewFaceCache

func NewFaceCache(face font.Face) *FaceCache

func (*FaceCache) Glyph

func (fc *FaceCache) Glyph(dot fixed.Point26_6, ru rune) (
	dr image.Rectangle,
	mask image.Image,
	maskp image.Point,
	advance fixed.Int26_6,
	ok bool,
)

func (*FaceCache) GlyphAdvance

func (fc *FaceCache) GlyphAdvance(ru rune) (advance fixed.Int26_6, ok bool)

func (*FaceCache) GlyphBounds

func (fc *FaceCache) GlyphBounds(ru rune) (bounds fixed.Rectangle26_6, advance fixed.Int26_6, ok bool)

func (*FaceCache) Kern

func (fc *FaceCache) Kern(r0, r1 rune) fixed.Int26_6

type FaceCacheL

type FaceCacheL struct {
	font.Face
	// contains filtered or unexported fields
}

Same as FaceCache but with locks.

func NewFaceCacheL

func NewFaceCacheL(face font.Face) *FaceCacheL

func (*FaceCacheL) Glyph

func (fc *FaceCacheL) Glyph(dot fixed.Point26_6, ru rune) (
	dr image.Rectangle,
	mask image.Image,
	maskp image.Point,
	advance fixed.Int26_6,
	ok bool,
)

func (*FaceCacheL) GlyphAdvance

func (fc *FaceCacheL) GlyphAdvance(ru rune) (advance fixed.Int26_6, ok bool)

func (*FaceCacheL) GlyphBounds

func (fc *FaceCacheL) GlyphBounds(ru rune) (bounds fixed.Rectangle26_6, advance fixed.Int26_6, ok bool)

func (*FaceCacheL) Kern

func (fc *FaceCacheL) Kern(r0, r1 rune) fixed.Int26_6

type FaceCacheL2

type FaceCacheL2 struct {
	font.Face
	// contains filtered or unexported fields
}

Same as FaceCacheL but with sync.map.

func NewFaceCacheL2

func NewFaceCacheL2(face font.Face) *FaceCacheL2

func (*FaceCacheL2) Glyph

func (fc *FaceCacheL2) Glyph(dot fixed.Point26_6, ru rune) (
	dr image.Rectangle,
	mask image.Image,
	maskp image.Point,
	advance fixed.Int26_6,
	ok bool,
)

func (*FaceCacheL2) GlyphAdvance

func (fc *FaceCacheL2) GlyphAdvance(ru rune) (advance fixed.Int26_6, ok bool)

func (*FaceCacheL2) GlyphBounds

func (fc *FaceCacheL2) GlyphBounds(ru rune) (bounds fixed.Rectangle26_6, advance fixed.Int26_6, ok bool)

func (*FaceCacheL2) Kern

func (fc *FaceCacheL2) Kern(r0, r1 rune) fixed.Int26_6

type FaceFallback added in v1.3.13

type FaceFallback struct {
	font.Face

	IsMono  bool
	MonoAdv fixed.Int26_6
	// contains filtered or unexported fields
}

func NewFaceFallback added in v1.3.13

func NewFaceFallback(face font.Face, fallbackFaces []font.Face, isMono bool, monoAdv fixed.Int26_6) *FaceFallback

func (*FaceFallback) Glyph added in v1.3.13

func (ff *FaceFallback) Glyph(dot fixed.Point26_6, ru rune) (
	dr image.Rectangle,
	mask image.Image,
	maskp image.Point,
	advance fixed.Int26_6,
	ok bool,
)

func (*FaceFallback) GlyphAdvance added in v1.3.13

func (ff *FaceFallback) GlyphAdvance(ru rune) (advance fixed.Int26_6, ok bool)

func (*FaceFallback) GlyphBounds added in v1.3.13

func (ff *FaceFallback) GlyphBounds(ru rune) (bounds fixed.Rectangle26_6, advance fixed.Int26_6, ok bool)

func (*FaceFallback) Kern added in v1.3.13

func (ff *FaceFallback) Kern(r0, r1 rune) fixed.Int26_6

type FaceOptions added in v1.3.13

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

avoid zero value in size/dpi by forcing set funcs; use existing copies

func NewFaceOptions added in v1.3.13

func NewFaceOptions(size, dpi float64) FaceOptions

func (*FaceOptions) DPI added in v1.3.13

func (o *FaceOptions) DPI() float64

func (*FaceOptions) SetDPI added in v1.3.13

func (o *FaceOptions) SetDPI(v float64)

func (*FaceOptions) SetHinting added in v1.3.13

func (o *FaceOptions) SetHinting(h font.Hinting)

func (*FaceOptions) SetSize added in v1.3.13

func (o *FaceOptions) SetSize(v float64)

func (*FaceOptions) Size added in v1.3.13

func (o *FaceOptions) Size() float64

type FaceRunes

type FaceRunes struct {
	font.Face
}

Special runes face

func NewFaceRunes

func NewFaceRunes(face font.Face) *FaceRunes

func (*FaceRunes) Glyph

func (fr *FaceRunes) Glyph(dot fixed.Point26_6, ru rune) (
	dr image.Rectangle,
	mask image.Image,
	maskp image.Point,
	advance fixed.Int26_6,
	ok bool,
)

func (*FaceRunes) GlyphAdvance

func (fr *FaceRunes) GlyphAdvance(ru rune) (advance fixed.Int26_6, ok bool)

func (*FaceRunes) GlyphBounds

func (fr *FaceRunes) GlyphBounds(ru rune) (bounds fixed.Rectangle26_6, advance fixed.Int26_6, ok bool)

type Font

type Font struct {
	Font *sfnt.Font

	SrcName string
	// contains filtered or unexported fields
}

func NewFont

func NewFont(fm *FontsManager, ttf []byte, srcName string) (*Font, error)

func (*Font) ClearFacesCache

func (f *Font) ClearFacesCache()

func (*Font) FontFace

func (f *Font) FontFace(fopts FaceOptions) *FontFace

func (*Font) Name added in v1.3.13

func (f *Font) Name() string

func (*Font) NameID added in v1.3.13

func (f *Font) NameID() string

type FontFace

type FontFace struct {
	Font    *Font
	Face    font.Face
	Opts    FaceOptions // readonly, make copy and change
	Metrics *font.Metrics
	// contains filtered or unexported fields
}

func NewFontFace

func NewFontFace(font *Font, fopts FaceOptions) *FontFace

func (*FontFace) AvgGlyphAdvance added in v1.3.13

func (ff *FontFace) AvgGlyphAdvance() fixed.Int26_6

func (*FontFace) BaseLine

func (ff *FontFace) BaseLine() fixed.Point26_6

func (*FontFace) LineHeight

func (ff *FontFace) LineHeight() fixed.Int26_6

func (*FontFace) LineHeightFloat

func (ff *FontFace) LineHeightFloat() float64

func (*FontFace) LineHeightInt

func (ff *FontFace) LineHeightInt() int

func (*FontFace) TestIsMono added in v1.3.13

func (ff *FontFace) TestIsMono() bool

type FontsManager

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

func NewFontsManager

func NewFontsManager() *FontsManager

func (*FontsManager) AddFallbackFont added in v1.3.13

func (fm *FontsManager) AddFallbackFont(f *Font)

func (*FontsManager) Aliases added in v1.3.13

func (fm *FontsManager) Aliases(targetName string) []string

func (*FontsManager) ClearFontsCache

func (fm *FontsManager) ClearFontsCache()

func (*FontsManager) DefaultFont added in v1.3.13

func (fm *FontsManager) DefaultFont() *Font

func (*FontsManager) DefaultFontFace added in v1.3.13

func (fm *FontsManager) DefaultFontFace() *FontFace

func (*FontsManager) DefaultMonoFont added in v1.3.13

func (fm *FontsManager) DefaultMonoFont() *Font

func (*FontsManager) DefaultMonoFontFace added in v1.3.13

func (fm *FontsManager) DefaultMonoFontFace() *FontFace

func (*FontsManager) FallbackFonts added in v1.3.13

func (fm *FontsManager) FallbackFonts() []*Font

func (*FontsManager) Font

func (fm *FontsManager) Font(ttf []byte, srcName string) (*Font, error)

func (*FontsManager) FontByName added in v1.3.13

func (fm *FontsManager) FontByName(name string) *Font

func (*FontsManager) LoadedFonts added in v1.3.13

func (fm *FontsManager) LoadedFonts() []*Font

func (*FontsManager) RegisterAlias added in v1.3.13

func (fm *FontsManager) RegisterAlias(alias, targetName string)

type GlyphAdvanceCache

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

func NewGlyphAdvanceCache

func NewGlyphAdvanceCache(face font.Face, ru rune) *GlyphAdvanceCache

type GlyphBoundsCache

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

func NewGlyphBoundsCache

func NewGlyphBoundsCache(face font.Face, ru rune) *GlyphBoundsCache

type GlyphCache

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

func NewGlyphCache

func NewGlyphCache(face font.Face, ru rune) *GlyphCache

Jump to

Keyboard shortcuts

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