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)
| 407 | // cssAgg, if non-nil, should contain CSSAgg properties -- will be tested for |
| 408 | // special css styling of each element. |
| 409 | func (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 |