font

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package font provides Go bindings for Android Font.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error int32

Error represents an NDK error code.

func (Error) Error

func (e Error) Error() string

type FAMILY_VARIANT

type FAMILY_VARIANT int32
const (
	AFAMILY_VARIANT_DEFAULT FAMILY_VARIANT = 0
	AFAMILY_VARIANT_COMPACT FAMILY_VARIANT = 1
	AFAMILY_VARIANT_ELEGANT FAMILY_VARIANT = 2
)

type Font

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

Font wraps the NDK AFont handle.

func NewFontFromPointer

func NewFontFromPointer(ptr unsafe.Pointer) *Font

NewFontFromPointer wraps a raw AFont pointer.

func (*Font) Close

func (h *Font) Close() error

Close releases the underlying NDK handle.

func (*Font) GetAxisCount

func (h *Font) GetAxisCount() uint64

GetAxisCount returns the value directly.

func (*Font) GetAxisTag

func (h *Font) GetAxisTag(axisIndex uint32) error

GetAxisTag calls the underlying NDK function.

func (*Font) GetAxisValue

func (h *Font) GetAxisValue(axisIndex uint32) float32

GetAxisValue returns the value directly.

func (*Font) GetCollectionIndex

func (h *Font) GetCollectionIndex() uint64

GetCollectionIndex returns the value directly.

func (*Font) GetFontFilePath

func (h *Font) GetFontFilePath() string

GetFontFilePath returns the value directly.

func (*Font) GetLocale

func (h *Font) GetLocale() string

GetLocale returns the value directly.

func (*Font) IsItalic

func (h *Font) IsItalic() bool

IsItalic returns the value directly.

func (*Font) Pointer

func (h *Font) Pointer() unsafe.Pointer

Pointer returns the underlying pointer as unsafe.Pointer.

func (*Font) Weight

func (h *Font) Weight() uint16

Weight returns the value directly.

type Matcher

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

Matcher wraps the NDK AFontMatcher handle.

func NewMatcher

func NewMatcher() *Matcher

NewMatcher creates a new Matcher.

func NewMatcherFromPointer

func NewMatcherFromPointer(ptr unsafe.Pointer) *Matcher

NewMatcherFromPointer wraps a raw AFontMatcher pointer.

func (*Matcher) Close

func (h *Matcher) Close() error

Close releases the underlying NDK handle.

func (*Matcher) Match

func (h *Matcher) Match(familyName string, text *uint16, textLength uint32, runLengthOut *uint32) *Font

Match creates a new Font from this Matcher.

func (*Matcher) Pointer

func (h *Matcher) Pointer() unsafe.Pointer

Pointer returns the underlying pointer as unsafe.Pointer.

func (*Matcher) SetFamilyVariant

func (h *Matcher) SetFamilyVariant(familyVariant uint32)

SetFamilyVariant calls the underlying NDK function.

func (*Matcher) SetLocales

func (h *Matcher) SetLocales(languageTags string)

SetLocales calls the underlying NDK function.

func (*Matcher) SetStyle

func (h *Matcher) SetStyle(weight uint16, italic bool) *Matcher

SetStyle sets a property and returns the receiver for chaining.

type SystemFontIterator

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

SystemFontIterator wraps the NDK ASystemFontIterator handle.

func ASystemFontIterator_open

func ASystemFontIterator_open() *SystemFontIterator

ASystemFontIterator_open calls the underlying C function.

func NewSystemFontIteratorFromPointer

func NewSystemFontIteratorFromPointer(ptr unsafe.Pointer) *SystemFontIterator

NewSystemFontIteratorFromPointer wraps a raw ASystemFontIterator pointer.

func (*SystemFontIterator) Close

func (h *SystemFontIterator) Close() error

Close releases the underlying NDK handle.

func (*SystemFontIterator) Next

func (h *SystemFontIterator) Next() *Font

Next creates a new Font from this SystemFontIterator.

func (*SystemFontIterator) Pointer

func (h *SystemFontIterator) Pointer() unsafe.Pointer

Pointer returns the underlying pointer as unsafe.Pointer.

type Weight

type Weight int32
const (
	Min        Weight = 0
	Thin       Weight = 100
	ExtraLight Weight = 200
	Light      Weight = 300
	Normal     Weight = 400
	Medium     Weight = 500
	SemiBold   Weight = 600
	Bold       Weight = 700
	ExtraBold  Weight = 800
	Black      Weight = 900
	Max        Weight = 1000
)

Jump to

Keyboard shortcuts

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