textdraw

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Start  = giotext.Start
	End    = giotext.End
	Middle = giotext.Middle
)

Variables

View Source
var Default = EN_US
View Source
var EN_US = system.Locale{Language: "en-US", Direction: system.LTR}
View Source
var NL = system.Locale{Language: "nl", Direction: system.LTR}
View Source
var ZH_CN = system.Locale{Language: "zh-CN", Direction: system.LTR}

Functions

func FillLabel

func FillLabel(gtx layout.Context, shaper *text.Shaper, style TextStyle, rect image.Rectangle, ax, ay float32, radius int, fill, onFill color.Color, str string) layout.Dimensions

func FillText

func FillText(gtx layout.Context, shaper *text.Shaper, style TextStyle, rect image.Rectangle, ax, ay float32, fill color.Color, str string)

func Label

func Label(shaper *text.Shaper, style TextStyle, ax, ay float32, radius int, fill, onFill color.Color, str string) layout.Widget

func MeasureText

func MeasureText(gtx layout.Context, shaper *text.Shaper, style TextStyle, str string) image.Point

func Text

func Text(shaper *text.Shaper, style TextStyle, ax, ay float32, fill color.Color, str string) layout.Widget

Types

type FontFace

type FontFace = font.FontFace

type TextStyle

type TextStyle struct {
	// Font describes the preferred typeface.
	Font font.Font
	// Alignment characterizes the positioning of text within the line. It does not directly
	// impact shaping, but is provided in order to allow efficient offset computation.
	Alignment text.Alignment
	// Size is the Sp size to shape the text with.
	Size unit.Sp
	// MaxLines limits the quantity of shaped lines. Zero means no limit.
	MaxLines int
	// Truncator is a string of text to insert where the shaped text was truncated, which
	// can currently ohly happen if MaxLines is nonzero and the text on the final line is
	// truncated.
	Truncator string
	// WrapPolicy configures how line breaks will be chosen when wrapping text across lines.
	WrapPolicy text.WrapPolicy
}

TextStyle contains the styling parameters for a block of text.

Jump to

Keyboard shortcuts

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