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

Method configTextSize

core/text.go:294–300  ·  view source on GitHub ↗

configTextSize does the HTML and Layout in paintText for text, using given size to constrain layout.

(sz math32.Vector2)

Source from the content-addressed store, hash-verified

292// configTextSize does the HTML and Layout in paintText for text,
293// using given size to constrain layout.
294func (tx *Text) configTextSize(sz math32.Vector2) {
295 // todo: last arg is CSSAgg. Can synthesize that some other way?
296 fs := tx.Styles.FontRender()
297 txs := &tx.Styles.Text
298 tx.paintText.SetHTML(tx.Text, fs, txs, &tx.Styles.UnitContext, nil)
299 tx.paintText.Layout(txs, fs, &tx.Styles.UnitContext, sz)
300}
301
302// configTextAlloc is used for determining how much space the text
303// takes, using given size (typically Alloc).

Callers 2

InitMethod · 0.95
SizeUpMethod · 0.95

Calls 3

FontRenderMethod · 0.80
SetHTMLMethod · 0.80
LayoutMethod · 0.80

Tested by

no test coverage detected