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

Method SetHTML

paint/text.go:409–415  ·  view source on GitHub ↗

SetHTML sets text by decoding all standard inline HTML text style formatting tags in the string and sets the per-character font information appropriately, using given font style info. and tags create new spans, with marking start of subsequent span with DecoParaStart. Critically, it do

(str string, font *styles.FontRender, txtSty *styles.Text, ctxt *units.Context, cssAgg map[string]any)

Source from the content-addressed store, hash-verified

407// cssAgg, if non-nil, should contain CSSAgg properties -- will be tested for
408// special css styling of each element.
409func (tr *Text) SetHTML(str string, font *styles.FontRender, txtSty *styles.Text, ctxt *units.Context, cssAgg map[string]any) {
410 if txtSty.HasPre() {
411 tr.SetHTMLPre([]byte(str), font, txtSty, ctxt, cssAgg)
412 } else {
413 tr.SetHTMLNoPre([]byte(str), font, txtSty, ctxt, cssAgg)
414 }
415}
416
417// SetHTMLBytes does SetHTML with bytes as input -- more efficient -- use this
418// if already in bytes

Callers 7

TestRenderFunction · 0.95
TestTextFunction · 0.95
RenderMethod · 0.95
ConfigMethod · 0.80
configTextSizeMethod · 0.80
configTextAllocMethod · 0.80
RenderTextMethod · 0.80

Calls 3

SetHTMLPreMethod · 0.95
SetHTMLNoPreMethod · 0.95
HasPreMethod · 0.80

Tested by 2

TestRenderFunction · 0.76
TestTextFunction · 0.76