SetString is for basic text rendering with a single style of text (see SetHTML for tag-formatted text) -- configures a single Span with the entire string, and does standard layout (LR currently). rot and scalex are general rotation and x-scaling to apply to all chars -- alternatively can apply thes
(str string, fontSty *styles.FontRender, ctxt *units.Context, txtSty *styles.Text, noBG bool, rot, scalex float32)
| 275 | // valid Face is available. noBG ignores any BackgroundColor in font style, and never |
| 276 | // renders background color |
| 277 | func (tr *Text) SetString(str string, fontSty *styles.FontRender, ctxt *units.Context, txtSty *styles.Text, noBG bool, rot, scalex float32) { |
| 278 | if len(tr.Spans) != 1 { |
| 279 | tr.Spans = make([]Span, 1) |
| 280 | } |
| 281 | tr.Links = nil |
| 282 | sr := &(tr.Spans[0]) |
| 283 | sr.SetString(str, fontSty, ctxt, noBG, rot, scalex) |
| 284 | sr.SetRunePosLR(txtSty.LetterSpacing.Dots, txtSty.WordSpacing.Dots, fontSty.Face.Metrics.Ch, txtSty.TabSize) |
| 285 | ssz := sr.SizeHV() |
| 286 | vht := fontSty.Face.Face.Metrics().Height |
| 287 | tr.BBox.Min.SetZero() |
| 288 | tr.BBox.Max = math32.Vec2(ssz.X, math32.FromFixed(vht)) |
| 289 | } |
| 290 | |
| 291 | // SetStringRot90 is for basic text rendering with a single style of text (see |
| 292 | // SetHTML for tag-formatted text) -- configures a single Span with the |