Documentation
¶
Overview ¶
Package text lays out text and rasterizes glyphs with the system's own text stack: DirectWrite on Windows, Core Text on macOS and Pango with cairo on Linux. They find the fonts, fall back to other fonts for what one lacks, shape and break lines; the package assembles their lines into layouts, with carets, selection and truncation of its own, and keeps the glyphs in the atlases scenes draw from. All methods of System are safe from any goroutine; the ui package uses them from the main thread.
Index ¶
- Constants
- func EncodeSpans(spans []Span) string
- func IsWordRune(r rune) bool
- func StandsAlone(r rune) bool
- func WordBoundary(a, b rune) bool
- type Affinity
- type Align
- type Boundaries
- func (b *Boundaries) GraphemeOffsets() []int
- func (b *Boundaries) NextGrapheme(i int) int
- func (b *Boundaries) NextWord(i int) int
- func (b *Boundaries) PrevGrapheme(i int) int
- func (b *Boundaries) PrevWord(i int) int
- func (b *Boundaries) Reset(runes []rune)
- func (b *Boundaries) WordAt(i int) (start, end int)
- type CaretPosition
- type Decoration
- type Font
- type FontFamily
- type Glyph
- type GlyphImage
- type Layout
- func (l *Layout) AppendSelection(dst []Rect, start, end int, on bool) []Rect
- func (l *Layout) Caret(index int) (x, y, h float32)
- func (l *Layout) CaretAt(p CaretPosition) (x, y, h float32)
- func (l *Layout) IndexAt(x, y float32) int
- func (l *Layout) LineAt(index int) int
- func (l *Layout) MoveCaret(p CaretPosition, direction int) CaretPosition
- func (l *Layout) PositionAt(x, y float32) CaretPosition
- func (l *Layout) Selection(start, end int) []Rect
- func (l *Layout) SelectionOn(start, end int, on bool) []Rect
- func (l *Layout) SelectionRanges(a, b CaretPosition) []Range
- func (l *Layout) SelectionVisual(start, end int, on bool) []Rect
- type Line
- type LineStyle
- type Params
- type Range
- type Rect
- type Shade
- type Span
- type Stroke
- type Style
- type System
- func (s *System) Baseline(y float32) float32
- func (s *System) BeginFrame()
- func (s *System) Decorate(l *Layout, li, i, j int, x, y, scale float32, d Decoration, ls LineStyle) []Stroke
- func (s *System) EndFrame()
- func (s *System) FontFamilies() []FontFamily
- func (s *System) Full() bool
- func (s *System) Generation() uint64
- func (s *System) Glyph(f *Font, id uint32, scale, x float32, shade Shade, opaque bool) GlyphImage
- func (s *System) GlyphRun(f *Font, ids []uint32, xs []float32, scale float32, shade Shade, opaque bool) GlyphImage
- func (s *System) JoinsGlyphs() bool
- func (s *System) Language() string
- func (s *System) Layout(p Params) *Layout
- func (s *System) LayoutFrom(l *Layout, p Params) *Layout
- func (s *System) LayoutsMade() uint64
- func (s *System) MakeRoom()
- func (s *System) Mask(key uint64, draw func() (w, h int, pix []byte)) GlyphImage
- func (s *System) Metrics(style Style) (ascent, descent, lineHeight float32)
- func (s *System) Origin(f *Font, scale, x float32, opaque bool) float32
- func (s *System) Preload()
- func (s *System) RegisterFont(data []byte, family string) error
- func (s *System) ReleaseShaping()
- func (s *System) SetFontRendering(antialias, hinting, subpixels string)
- func (s *System) SetLanguage(tag string)
- func (s *System) SetUIFamily(family string)
- func (s *System) ShadowGlyph(f *Font, id uint32, scale, x float32, shade Shade, opaque bool, sigma float32) GlyphImage
- func (s *System) Shape(p Params) *Layout
- func (s *System) Shares(a GlyphImage, ax, ay float32, b GlyphImage, bx, by float32) bool
- func (s *System) StrokeGlyph(f *Font, id uint32, scale, x float32, shade Shade, opaque bool, width float32) GlyphImage
- func (s *System) TextParams() scene.TextParams
- func (s *System) TransientUses() uint64
- func (s *System) Unkeep(keys []uint64)
- func (s *System) UseJustify()
- func (s *System) UsePretty()
- func (s *System) UseTabSize()
Constants ¶
const Shades = 4
Shades is the number of shades of text.
Variables ¶
This section is empty.
Functions ¶
func EncodeSpans ¶
EncodeSpans writes spans for Params.Spans, which, as a string, keeps Params a value layouts are cached by.
func IsWordRune ¶ added in v0.1.13
IsWordRune reports whether r is part of a word: a letter, a digit or an underscore.
func StandsAlone ¶ added in v0.1.13
StandsAlone reports whether r is a word on its own: a Han ideograph (with the iteration mark 々), a Hiragana or a Katakana (with the prolonged sound mark ー).
func WordBoundary ¶ added in v0.1.13
WordBoundary reports whether a and b, next to each other, are in different words or runs of other runes: one is part of a word and the other is not, or either is a word on its own (StandsAlone). Script changes between Latin and Han or kana and kanji are boundaries so.
Types ¶
type Affinity ¶
type Affinity uint8
Affinity chooses the preceding or following logical text at a boundary. The two edges can occupy different positions in bidi text or at a wrap.
type Boundaries ¶
type Boundaries struct {
// contains filtered or unexported fields
}
Boundaries finds grapheme and word boundaries in text.
func (*Boundaries) GraphemeOffsets ¶
func (b *Boundaries) GraphemeOffsets() []int
GraphemeOffsets returns a copy of the grapheme starts and text's end for a retained shaped-text layout.
func (*Boundaries) NextGrapheme ¶
func (b *Boundaries) NextGrapheme(i int) int
NextGrapheme returns the end of the grapheme starting at or containing i.
func (*Boundaries) NextWord ¶
func (b *Boundaries) NextWord(i int) int
NextWord returns the end of the word after i, skipping what is between. Each ideograph and kana is a word (see WordBoundary).
func (*Boundaries) PrevGrapheme ¶
func (b *Boundaries) PrevGrapheme(i int) int
PrevGrapheme returns the start of the grapheme before i.
func (*Boundaries) PrevWord ¶
func (b *Boundaries) PrevWord(i int) int
PrevWord returns the start of the word before i.
func (*Boundaries) WordAt ¶
func (b *Boundaries) WordAt(i int) (start, end int)
WordAt returns the word, or the run of other runes, around i, within its line: an ideograph or a kana is a word alone.
type CaretPosition ¶
type Decoration ¶
type Decoration uint8
Decoration is a line drawn along text.
const ( Underline Decoration = iota Strikethrough // SolidUnderline is an Underline drawn through descenders, as links // mark hover, instead of skipping the ink of glyphs as Core Text does. SolidUnderline )
type Font ¶
type Font struct {
// Size is the em size in DIPs.
Size float32
// Ascent, Descent and LineGap are the font's vertical metrics in
// DIPs.
Ascent, Descent, LineGap float32
// contains filtered or unexported fields
}
Font is a font of the system, or of the app, at a size. Layouts and glyphs refer to fonts by pointer: an engine returns the same Font for the same font and size. A Font draws for as long as anything refers to it, after the System let go of it too (nativeFonts).
type FontFamily ¶
type FontFamily struct {
Name string
// Monospaced is whether its regular font gives every character the
// same advance.
Monospaced bool
// Registered is whether the app registered it (RegisterFont).
Registered bool
}
A FontFamily is a font family text can use.
type Glyph ¶
type Glyph struct {
Font *Font
ID uint32
// Size is the font size in DIPs.
Size float32
// X is the glyph's drawing origin, including shaping offsets, Y its
// baseline. Advance moves the pen independently of those offsets.
X, Y float32
Advance float32
// Cluster is the first rune of the glyph's cluster, Runes how many
// runes the cluster holds; glyphs of the ellipsis have Runes 0.
Cluster, Runes int
// RTL marks a glyph of a right-to-left run, whose cluster's first
// rune is on its right.
RTL bool
// Object marks the box of an inline object (Span.ObjectWidth), which
// draws no glyph: what shows there is the caller's.
Object bool
}
Glyph is a positioned glyph.
type GlyphImage ¶
type GlyphImage struct {
// OK is false for glyphs without pixels, such as spaces.
OK bool
// Colored glyphs are in the color atlas, the others in the mask atlas
// but Subpixel ones, in the color atlas too, which hold the coverage of
// each pixel's red, green and blue subpixels.
Colored, Subpixel bool
// Thin glyphs are of a font too thin for antialiasing, which renderers
// give more contrast (scene.Glyph.Thin).
Thin bool
// X, Y, W and H are the bitmap's rectangle in its atlas.
X, Y, W, H uint16
// Left and Top place the bitmap relative to the glyph's origin on the
// baseline, in pixels: Top is usually negative.
Left, Top float32
}
GlyphImage is a rasterized glyph in an atlas.
type Layout ¶
type Layout struct {
Params Params
Runes []rune
Lines []Line
// Width is the width of the longest line, the first line's indent
// included, Height the sum of the line heights.
Width, Height float32
// Truncated reports that MaxLines cut the text.
Truncated bool
// contains filtered or unexported fields
}
Layout is shaped and wrapped text. Positions are in DIPs relative to the top-left corner of the text.
func (*Layout) AppendSelection ¶
AppendSelection appends the rectangles of SelectionVisual to dst, for callers that keep them frame after frame.
func (*Layout) Caret ¶
Caret returns the position of the caret before rune index: its x, the top of its line and the line's height.
func (*Layout) CaretAt ¶
func (l *Layout) CaretAt(p CaretPosition) (x, y, h float32)
CaretAt preserves affinity at bidi boundaries and soft line breaks.
func (*Layout) LineAt ¶
LineAt returns the index of the line holding rune index, the start of the next line at a soft line break.
func (*Layout) MoveCaret ¶
func (l *Layout) MoveCaret(p CaretPosition, direction int) CaretPosition
MoveCaret advances one visual grapheme, preserving the edge arrived at.
func (*Layout) PositionAt ¶
func (l *Layout) PositionAt(x, y float32) CaretPosition
PositionAt hit-tests whole graphemes, retaining the visual edge chosen.
func (*Layout) SelectionOn ¶
SelectionOn is Selection for a layout of a paragraph of a longer text, whose selection goes on past the newline after the paragraph when on is set: the newline shows, as between the lines of a layout.
func (*Layout) SelectionRanges ¶
func (l *Layout) SelectionRanges(a, b CaretPosition) []Range
SelectionRanges returns logical ranges covered by a visual gesture. A gesture through mixed-direction text can cover discontiguous ranges.
func (*Layout) SelectionVisual ¶
SelectionVisual returns separate rectangles for selected visual runs. At bidi boundaries a logical range may cover disjoint areas on a line; taking the minimum and maximum caret would highlight intervening unselected text. on includes the paragraph's following newline, as SelectionOn does.
type Line ¶
type Line struct {
// X, Y, Width and Height are the line's box; X includes the alignment.
X, Y, Width, Height float32
// Baseline is the y of the baseline; Ascent and Descent the extent of
// the fonts above and below it.
Baseline, Ascent, Descent float32
// Start and End are the line's runes; a newline ending it is not
// included.
Start, End int
// RTL reports a right-to-left paragraph.
RTL bool
// Glyphs are in visual order, from the left, on every engine: X
// ascends but for shaping offsets, and Cluster descends through a
// right-to-left run (Glyph.RTL). The glyphs of a cluster are next to
// each other.
Glyphs []Glyph
// contains filtered or unexported fields
}
Line is a line of a Layout.
type LineStyle ¶ added in v0.1.17
type LineStyle struct {
// Thick, if positive, is the line's thickness in DIPs, around its
// middle, rounded to whole pixels (at least one) and on whole pixels,
// so that it is as sharp as browsers draw text-decoration-thickness.
Thick float32
// Offset, if HasOffset, puts the top of an underline Offset DIPs below
// the baseline, or above it if negative, rounded to whole pixels, as
// CSS's text-underline-offset does: an underline skipping ink skips
// the glyphs where it is then. Strikethroughs stay where they are.
Offset float32
HasOffset bool
}
LineStyle is how a decoration's line is drawn where the font leaves it otherwise.
type Params ¶
type Params struct {
Text string
Style Style
// Width wraps lines to this many DIPs; 0 or less only breaks lines at
// newlines.
Width float32
// MaxLines truncates the text to that many lines, ending it with
// Ellipsis ("…" when empty); 0 is unlimited.
MaxLines int
Ellipsis string
// NoWrap breaks lines only at newlines, aligning them within Width
// all the same.
NoWrap bool
Align Align
// RTL makes paragraphs without a strongly directional character, as
// numbers or an empty line, right to left, as in an interface laid out
// right to left; the others read in the direction of their first
// strongly directional character, as Unicode's bidirectional
// algorithm finds it by default (rules P2 and P3), whichever this is.
RTL bool
// KeepSpaces keeps the advance of whitespace at the end of wrapped
// lines, as text editors do.
KeepSpaces bool
// NoBreakWords only breaks lines between words, letting a long word
// overflow the width instead of breaking it.
NoBreakWords bool
// Indent moves the first line of the text this many DIPs from the
// start of its paragraph's direction, the left or the right, and
// wraps it that much narrower, as CSS's text-indent; 0 or less is
// none. The lines after a newline are not indented.
Indent float32
// Justify stretches every line that Width wraps to Width, the
// whitespace ending it left out, by widening the spaces between its
// words and the room after Han characters and kana, as browsers
// justify text, once System.UseJustify was called. Align places the
// last line of each paragraph, and a line with nothing to widen.
Justify bool
// Balance wraps each paragraph that Width wraps in lines of about the
// same length, as CSS's text-wrap: balance does: in as many lines as
// it takes, wrapped at the narrowest width that keeps them as many,
// rather than full lines and a short last one. The lines are aligned
// within Width all the same. A paragraph that MaxLines cuts wraps as
// it would without it.
Balance bool
// Pretty keeps the last line of each paragraph that Width wraps from
// holding a single word, as CSS's text-wrap: pretty does at least: the
// line before gives it a word, wrapped as wide as that leaves them,
// the lines before as they are. A paragraph that Balance balances or
// MaxLines cuts wraps as it would without it. It takes effect once
// System.UsePretty was called.
Pretty bool
// Spans styles runs of the text apart from Style, as EncodeSpans
// writes them.
Spans string
}
Params describe a text to lay out.
type Rect ¶
type Rect struct{ X, Y, W, H float32 }
Rect is a rectangle in DIPs relative to the layout.
type Shade ¶
type Shade uint8
A Shade is how light the color of text is, from 0 (dark) to Shades-1 (light). Core Text's font smoothing, which AppKit draws text with, emboldens glyphs more the lighter their color is, in four steps of its relative luminance: the glyphs of its fonts are rasterized for each.
Flat is a shade beyond the others, for text drawn without font smoothing, whatever its color: thinner, as browsers draw text styled -webkit-font-smoothing: antialiased on macOS. Engines that do not smooth fonts draw it as other text.
Thick is a shade beyond the others, for text drawn thicker: with Core Text's font smoothing at its strongest, whatever the text's color and the user's setting, as Ghostty's font-thicken draws it. Engines that do not thicken glyphs draw them as for other text.
type Span ¶
type Span struct {
End int
Family string
Size float32
Weight int
Italic bool
LetterSpacing float32
// SpacingSet makes LetterSpacing the span's when zero too, rather
// than the text's, as CSS's letter-spacing: 0 on an inline box.
SpacingSet bool
Features string
// Lang is the language of the runes, as Style.Lang; "" keeps the
// text's.
Lang string
// ObjectWidth and ObjectHeight, when ObjectWidth is set, make each
// rune of the span, an object replacement character (U+FFFC), an
// inline object: a box that wide, standing that high on the baseline,
// which lines break around and which draws no glyph, as an image in a
// rich text's line (Glyph.Object). ObjectDescent extends the box that
// far below the baseline, as math's subscripts and fractions go.
ObjectWidth, ObjectHeight, ObjectDescent float32
// BaselineShift raises the span's glyphs and objects that many DIPs
// above the baseline, or lowers them when negative, as superscripts
// and subscripts are; the line makes room for them.
BaselineShift float32
// PaddingX widens the span that many DIPs at both ends of each line's
// piece of it, as the horizontal padding of CSS's inline boxes with
// box-decoration-break: clone: the glyphs move in, and the line, which
// breaks to fit it, is that much wider.
PaddingX float32
}
Span styles the runes of a text before End, after those of the spans before it. What it sets replaces the Style of the layout; Italic only turns italics on.
type Stroke ¶
type Stroke struct{ X0, X1, Top, Bottom float32 }
A Stroke is a stretch of a decoration's line, in device pixels: from X0 to X1 and from Top to Bottom, which renderers antialias where they fall within pixels.
type Style ¶
type Style struct {
// Family is a comma-separated list of font families, where "system-ui"
// and "monospace" are the system's own; "" is the system UI font.
Family string
// Size in DIPs; 0 is 14.
Size float32
// Weight from 100 (thin) to 900 (black); 0 is 400.
Weight int
Italic bool
// LineHeight is the height of a line as a multiple of Size; 0 takes
// the font's own line spacing.
LineHeight float32
// LetterSpacing adds DIPs after every character; negative tightens.
LetterSpacing float32
// Features are OpenType features, comma separated: a tag turns one
// on, and tag=value sets it, as "tnum, liga=0, salt=2".
Features string
// Lang is the language of the text, a BCP 47 tag as "ja" or
// "zh-Hant": the system's text stack picks the glyphs of that
// language, as the Han characters Chinese and Japanese write apart,
// and falls back to fonts for it. Korean text breaks its lines
// between words (keepWordsWhole). "" is the language of the System
// (SetLanguage).
Lang string
// TabSize puts tab stops every TabSize spaces of the style's font,
// letter spacing included, from the start of each line, as CSS's
// tab-size, once System.UseTabSize was called; 0 leaves them where
// the system's text stack puts them.
TabSize float32
// contains filtered or unexported fields
}
Style selects the font of a text.
type System ¶
type System struct {
// MaskAtlas holds coverage masks, ColorAtlas color glyphs.
MaskAtlas, ColorAtlas *scene.Atlas
// contains filtered or unexported fields
}
System lays out text and rasterizes glyphs with the system's own text engine. Use Shared.
func (*System) Baseline ¶
Baseline returns where the system's text stack draws a baseline that is y device pixels from the top: on a whole pixel.
func (*System) BeginFrame ¶
func (s *System) BeginFrame()
BeginFrame starts painting a frame: the masks drawn for the previous frame alone are forgotten.
func (*System) Decorate ¶
func (s *System) Decorate(l *Layout, li, i, j int, x, y, scale float32, d Decoration, ls LineStyle) []Stroke
Decorate returns the strokes the system's text stack draws for decoration d of glyphs [i, j) of line li of l, runes of one style, with the layout's origin at (x, y) DIPs, at scale pixels per DIP: placed as AppKit, Direct2D or GTK place underlines and strikethroughs, with their thickness, but for what ls sets.
func (*System) EndFrame ¶
func (s *System) EndFrame()
EndFrame forgets layouts no frame used for a while. The ui package calls it after each frame.
func (*System) FontFamilies ¶
func (s *System) FontFamilies() []FontFamily
FontFamilies lists the families text can use: the app's registered ones first, under the names it gave them, or their own when it gave none, then the system's, each once and sorted without regard to case. The system's are listed once, outside the lock, and kept until RegisterFont.
func (*System) Full ¶
Full reports whether an atlas filled up during the frame being painted and left out glyphs or masks it draws. MakeRoom then makes room for them.
func (*System) Generation ¶
Generation returns a number that changes whenever the system forgets its layouts, as it lets go of its fonts (EndFrame) or takes other ones: the layouts it returned before are then to be made anew. Until then they still draw, with the fonts they were made with.
func (*System) Glyph ¶
Glyph rasterizes glyph id of a font at scale pixels per DIP whose pen is x device pixels from the left, for text of a shade, placed as the system's text stack places glyphs: at one of the positions within a pixel it draws them at. Left is relative to the pixel x is in. Glyphs on opaque backgrounds may be subpixel ones, when the system's settings (TextParams) ask for subpixel antialiasing.
func (*System) GlyphRun ¶
func (s *System) GlyphRun(f *Font, ids []uint32, xs []float32, scale float32, shade Shade, opaque bool) GlyphImage
GlyphRun returns glyphs ids of a font, their pens at xs device pixels from the left, joined as the system's text stack draws a run whose antialiased edges share pixels (JoinsGlyphs): their coverage added and clamped. The glyphs are for text of a shade, on an opaque background or not, as for Glyph. Left is relative to the pixel the first pen is in.
func (*System) JoinsGlyphs ¶
JoinsGlyphs reports whether glyphs of a run whose edges share pixels look as the system's text stack draws them only joined (GlyphRun), with their coverage added before blending (cairo, GTK), rather than blended each in turn as renderers do (Core Graphics, Direct2D).
func (*System) Layout ¶
Layout shapes and wraps p.Text. The result is shared and must not be modified.
func (*System) LayoutFrom ¶ added in v0.1.17
LayoutFrom lays out p as Layout does, from l, if not nil, a layout of the same text at another width, as a box growing or shrinking lays its text out at each width: where l wraps none of its lines and fits p's width, p lays out alike, its lines aligned anew, rather than shaped again; at the left of their box, it shares them. So does the text's layout without a width, once made.
func (*System) LayoutsMade ¶
LayoutsMade returns how many layouts the system has made, those Layout found in its cache left out.
func (*System) MakeRoom ¶
func (s *System) MakeRoom()
MakeRoom makes room in the atlases that filled up: it keeps what the frame being painted drew, growing the atlas when that and what the frame still needs take much of it, or when room made for the frame before did not suffice, and forgets everything else. Everything kept moves, so the frame must be painted again.
func (*System) Mask ¶
func (s *System) Mask(key uint64, draw func() (w, h int, pix []byte)) GlyphImage
Mask returns a coverage mask cached under key in the mask atlas, drawing it when it is not: draw returns its size and one byte per pixel. Icons and other vector shapes use it.
A mask a frame draws for the first time may be one frame of an animation, never drawn again: it lasts for that frame only, in the atlas's transient room, and is cached once a later frame draws it too.
func (*System) Origin ¶ added in v0.1.17
Origin returns where Glyph puts the origin of a glyph of f whose pen is x device pixels from the left: at the position within a pixel the system's text stack draws it at.
func (*System) Preload ¶
func (s *System) Preload()
Preload starts the text engine and finds the system UI font, which the first layout otherwise waits for.
func (*System) RegisterFont ¶
RegisterFont adds a TrueType or OpenType font (or collection) to the fonts text can use, under family, or the font's own family name when family is empty.
func (*System) ReleaseShaping ¶ added in v0.1.17
func (s *System) ReleaseShaping()
ReleaseShaping lets go of what the engine keeps of text shaped lately, for when a window goes idle: the next frames shape it again.
func (*System) SetFontRendering ¶
SetFontRendering sets how text is rasterized where the system's text stack does not know the desktop's settings, as Pango on Linux: antialiasing ("none", "gray" or "subpixel"), hinting ("none", "slight", "medium" or "full") and the order of the screen's subpixels ("rgb", "bgr", "vrgb" or "vbgr"), "" for the default. Other engines ignore it.
func (*System) SetLanguage ¶
SetLanguage sets the language of the texts whose Style names none, a BCP 47 tag, or "" for none: the system's text stack then picks glyphs and fallback fonts as it does by default, by the user's settings. The ui package sets the language the app shows. The layouts made before are made anew (Generation).
func (*System) SetUIFamily ¶
SetUIFamily sets the family "system-ui" stands for where the system's text stack does not know the desktop's interface font, as Pango on Linux, which finds fontconfig's default sans-serif. Other engines ignore it.
func (*System) ShadowGlyph ¶ added in v0.1.17
func (s *System) ShadowGlyph(f *Font, id uint32, scale, x float32, shade Shade, opaque bool, sigma float32) GlyphImage
ShadowGlyph returns the coverage mask of the glyph Glyph returns for the same arguments blurred by a Gaussian of standard deviation sigma device pixels, placed as that glyph is, wider by the blur: a mask glyph, for color glyphs too, of their pixels' alpha, which a text's shadow (CSS's text-shadow) paints in its color.
func (*System) Shape ¶
Shape lays out p.Text as Layout does, but caches nothing, for text that its caller keeps or rarely draws twice. The result belongs to the caller.
func (*System) Shares ¶
func (s *System) Shares(a GlyphImage, ax, ay float32, b GlyphImage, bx, by float32) bool
Shares reports whether glyphs a and b, their bitmaps' top-left corners at (ax, ay) and (bx, by) device pixels, both cover a pixel.
func (*System) StrokeGlyph ¶ added in v0.1.17
func (s *System) StrokeGlyph(f *Font, id uint32, scale, x float32, shade Shade, opaque bool, width float32) GlyphImage
StrokeGlyph returns the coverage mask of a stroke width device pixels wide along the outline of the glyph Glyph returns for the same arguments, centered on it and round at its corners, placed as that glyph is: a mask glyph, for color glyphs too, which strokes the edge of their pixels. Text stroked under its fill (CSS's paint-order: stroke fill) shows the half outside the glyph.
func (*System) TextParams ¶
func (s *System) TextParams() scene.TextParams
TextParams returns how renderers correct the coverage of glyphs, as the system's settings say, for the frame being painted, and has glyphs on opaque backgrounds take subpixel antialiasing if they ask for it.
func (*System) TransientUses ¶ added in v0.1.13
TransientUses returns how many times Mask returned a mask drawn for the frame being painted alone, since the system started: a scene drawing one must not be drawn again after the next frame of any window begins (BeginFrame), which draws over it.
func (*System) Unkeep ¶ added in v0.1.17
Unkeep lets the masks cached under keys go as the atlas makes room for the frame being painted (MakeRoom), unless it draws them again first: masks it drew that the frame painted again draws otherwise, which the room made would keep but no paint draws.
func (*System) UseJustify ¶ added in v0.1.13
func (s *System) UseJustify()
UseJustify lets layouts justify their lines (Params.Justify), which package ui calls as the first TextShape asks for it.
func (*System) UsePretty ¶ added in v0.1.17
func (s *System) UsePretty()
UsePretty lets layouts keep the last line of a paragraph from holding a single word (Params.Pretty), which package ui calls as the first element or TextShape asks for it.
func (*System) UseTabSize ¶ added in v0.1.17
func (s *System) UseTabSize()
UseTabSize lets layouts set their tab stops (Style.TabSize), which package ui calls as the first element sets a tab size.