Skip to content

Fonts, images, and icon resources: Full declarations

Usage and examples · All APIs

These declarations are extracted from the Go AST, retaining English source contracts and field comments while hiding private fields. struct {} represents an opaque implementation, not permission to use a zero value instead of its constructor. Constant blocks retain iota context.

FontFamily

text
FontFamily is an application-visible family name used for deterministic
ordered fallback. It is not an operating-system font handle.
go
type FontFamily string

Related example · Source font.go:17

FontFamilyDefault

text
FontFamilyDefault is dxui's embedded, BSD-licensed Go Regular font. It
covers the MVP Latin samples but not CJK.
go
const (
	// FontFamilyDefault is dxui's embedded, BSD-licensed Go Regular font. It
	// covers the MVP Latin samples but not CJK.
	FontFamilyDefault FontFamily = internaltext.BuiltinFamily
	// FontFamilySystemSans resolves one fixed candidate list per operating
	// system; it is never searched by fuzzy display name.
	FontFamilySystemSans FontFamily = "system-ui"
	// FontFamilySystemMono is the deterministic system monospace family.
	FontFamilySystemMono FontFamily = "system-monospace"
	// FontFamilySystemCJK is the deterministic system CJK fallback family.
	FontFamilySystemCJK FontFamily = "system-cjk"
)

Related example · Source font.go:22

FontFamilySystemSans

text
FontFamilySystemSans resolves one fixed candidate list per operating
system; it is never searched by fuzzy display name.

See the corresponding constant block on this page for types and values.

Related example · Source font.go:25

FontFamilySystemMono

text
FontFamilySystemMono is the deterministic system monospace family.

See the corresponding constant block on this page for types and values.

Related example · Source font.go:27

FontFamilySystemCJK

text
FontFamilySystemCJK is the deterministic system CJK fallback family.

See the corresponding constant block on this page for types and values.

Related example · Source font.go:29

Font

text
Font registers one TTF/OTF/TTC face. A FontBytes value owns its copied bytes
for as long as that value or an App configured with it remains reachable.
FontFile handles and all parsed faces live only from App.Run text startup until
renderer teardown completes. The file is not copied into the Go heap.
FaceIndex selects a collection face and is zero
for ordinary fonts.
go
type Font struct {
	Family    FontFamily
	Weight    FontWeight
	Slant     FontSlant
	FaceIndex int
}

Related example · Source font.go:52

FontBytes

text
FontBytes creates an application-owned font from a defensive copy of data.
go
func FontBytes(family FontFamily, data []byte) Font

Related example · Source font.go:61

FontFile

text
FontFile creates a font loaded from the exact path during App.Run startup.
dxui does not search or copy the file into an application package.
go
func FontFile(family FontFamily, path string) Font

Related example · Source font.go:67

SystemFont

text
SystemFont requests one of the documented generic system families. The
resolver tests a fixed path list for the current OS and returns a startup
error when none exists; it never depends on fontconfig or fuzzy name search.
go
func SystemFont(family FontFamily) Font

Related example · Source font.go:74

Point

text
Point is a position in icon view-box coordinates.
go
type Point struct{ X, Y float32 }

Related example · Source internal/icondata/icondata.go:12

Rect

text
Rect is a rectangle in icon view-box coordinates.
go
type Rect struct{ X, Y, Width, Height float32 }

Related example · Source internal/icondata/icondata.go:15

PathCommand

text
PathCommand stores up to three points.
go
type PathCommand struct {
	Verb   PathVerb
	Points [3]Point
}

Related example · Source internal/icondata/icondata.go:29

PaintMode

text
PaintMode identifies whether a packed path is filled or stroked.
go
type PaintMode uint8

Related example · Source internal/icondata/icondata.go:35

PaintStroke

go
const (
	PaintStroke PaintMode = iota
	PaintFill
)

Related example · Source internal/icondata/icondata.go:38

PaintFill

See the corresponding constant block on this page for types and values.

Related example · Source internal/icondata/icondata.go:39

Path

text
Path is one decoded path with a single paint mode.
go
type Path struct {
	Mode     PaintMode
	Commands []PathCommand
}

Related example · Source internal/icondata/icondata.go:43

Data

text
Data is immutable when returned by Packed. Commands remains exported for
compatibility with application-authored filled icons; callers own that
slice and dxui copies it when constructing a View.
go
type Data struct {
	ViewBox  Rect
	Commands []PathCommand
}

Related example · Source internal/icondata/icondata.go:51

IconData.IsPacked

text
IsPacked reports whether data uses the immutable generated representation.
go
func (data Data) IsPacked() bool

Related example · Source internal/icondata/icondata.go:70

IconData.Identity

text
Identity returns a stable content identity without exposing packed bytes.
go
func (data Data) Identity() uint64

Related example · Source internal/icondata/icondata.go:73

IconData.Paths

text
Paths validates and decodes data. Legacy Commands form one filled path.
go
func (data Data) Paths(maxCommands int) ([]Path, error)

Related example · Source internal/icondata/icondata.go:99