MCPcopy Create free account
hub / github.com/cogentcore/core / Layout

Method Layout

paint/textlayout.go:168–171  ·  view source on GitHub ↗

TextStyle-based Layout Routines Layout does basic standard layout of text using Text style parameters, assigning relative positions to spans and runes according to given styles, and given size overall box. Nonzero values used to constrain, with the width used as a hard constraint to drive word wra

(txtSty *styles.Text, fontSty *styles.FontRender, ctxt *units.Context, size math32.Vector2)

Source from the content-addressed store, hash-verified

166// Font face in styles.Font is used for determining line spacing here.
167// Other versions can do more expensive calculations of variable line spacing as needed.
168func (tr *Text) Layout(txtSty *styles.Text, fontSty *styles.FontRender, ctxt *units.Context, size math32.Vector2) math32.Vector2 {
169 // todo: switch on layout types once others are supported
170 return tr.LayoutStdLR(txtSty, fontSty, ctxt, size)
171}
172
173// LayoutStdLR does basic standard layout of text in LR direction.
174func (tr *Text) LayoutStdLR(txtSty *styles.Text, fontSty *styles.FontRender, ctxt *units.Context, size math32.Vector2) math32.Vector2 {

Callers 10

TestRenderFunction · 0.95
TestTextFunction · 0.95
RenderMethod · 0.95
ConfigMethod · 0.80
configTextSizeMethod · 0.80
configTextAllocMethod · 0.80
configTextSizeMethod · 0.80
RenderMethod · 0.80
layoutAllLinesMethod · 0.80
layoutLineMethod · 0.80

Calls 1

LayoutStdLRMethod · 0.95

Tested by 2

TestRenderFunction · 0.76
TestTextFunction · 0.76