gioui.org: gioui.org/text Index | Files

package text

import "gioui.org/text"

Index

Package Files

lru.go shaper.go text.go

type Alignment Uses

type Alignment uint8
const (
    Start Alignment = iota
    End
    Middle
)

func (Alignment) String Uses

func (a Alignment) String() string

type Face Uses

type Face interface {
    Layout(ppem fixed.Int26_6, str string, opts LayoutOptions) *Layout
    Shape(ppem fixed.Int26_6, str String) clip.Op
}

Face implements text layout and shaping for a particular font.

type Font Uses

type Font struct {
    Typeface Typeface
    Variant  Variant
    Size     unit.Value
    Style    Style
    // Weight is the text weight. If zero, Normal is used instead.
    Weight Weight
}

Font specify a particular typeface, style and size.

type Layout Uses

type Layout struct {
    Lines []Line
}

A Layout contains the measurements of a body of text as a list of Lines.

type LayoutOptions Uses

type LayoutOptions struct {
    // MaxWidth is the available width of the layout.
    MaxWidth int
}

LayoutOptions specify the constraints of a text layout.

type Line Uses

type Line struct {
    Text String
    // Width is the width of the line.
    Width fixed.Int26_6
    // Ascent is the height above the baseline.
    Ascent fixed.Int26_6
    // Descent is the height below the baseline, including
    // the line gap.
    Descent fixed.Int26_6
    // Bounds is the visible bounds of the line.
    Bounds fixed.Rectangle26_6
}

A Line contains the measurements of a line of text.

type Shaper Uses

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

Shaper implements layout and shaping of text and a cache of computed results.

Specify the default and fallback font by calling Register with the empty Font.

func (*Shaper) Layout Uses

func (s *Shaper) Layout(c unit.Converter, font Font, str string, opts LayoutOptions) *Layout

func (*Shaper) Register Uses

func (s *Shaper) Register(font Font, tf Face)

func (*Shaper) Shape Uses

func (s *Shaper) Shape(c unit.Converter, font Font, str String) clip.Op

type String Uses

type String struct {
    String string
    // Advances contain the advance of each rune in String.
    Advances []fixed.Int26_6
}

type Style Uses

type Style int

Style is the font style.

const (
    Regular Style = iota
    Italic
)

type Typeface Uses

type Typeface string

Typeface identifies a particular typeface design. The empty string denotes the default typeface.

type Variant Uses

type Variant string

Variant denotes a typeface variant such as "Mono" or "Smallcaps".

type Weight Uses

type Weight int

Weight is a font weight, in CSS units.

const (
    Normal Weight = 400
    Medium Weight = 500
    Bold   Weight = 600
)

Package text imports 4 packages (graph) and is imported by 14 packages. Updated 2019-11-18. Refresh now. Tools for package owners.