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

Method configTextSize

core/textfield.go:1810–1826  ·  view source on GitHub ↗
(sz math32.Vector2)

Source from the content-addressed store, hash-verified

1808}
1809
1810func (tf *TextField) configTextSize(sz math32.Vector2) math32.Vector2 {
1811 st := &tf.Styles
1812 txs := &st.Text
1813 fs := st.FontRender()
1814 st.Font = paint.OpenFont(fs, &st.UnitContext)
1815 txt := tf.editText
1816 if tf.NoEcho {
1817 txt = concealDots(len(tf.editText))
1818 }
1819 align, alignV := txs.Align, txs.AlignV
1820 txs.Align, txs.AlignV = styles.Start, styles.Start // only works with this
1821 tf.renderAll.SetRunes(txt, fs, &st.UnitContext, txs, true, 0, 0)
1822 tf.renderAll.Layout(txs, fs, &st.UnitContext, sz)
1823 txs.Align, txs.AlignV = align, alignV
1824 rsz := tf.renderAll.BBox.Size().Ceil()
1825 return rsz
1826}
1827
1828func (tf *TextField) iconsSize() math32.Vector2 {
1829 var sz math32.Vector2

Callers 3

autoScrollMethod · 0.95
SizeUpMethod · 0.95
SizeDownMethod · 0.95

Calls 7

OpenFontFunction · 0.92
concealDotsFunction · 0.85
FontRenderMethod · 0.80
LayoutMethod · 0.80
SizeMethod · 0.65
SetRunesMethod · 0.45
CeilMethod · 0.45

Tested by

no test coverage detected