RenderTopPos renders at given top position -- uses first font info to compute baseline offset and calls overall Render -- convenience for simple widget rendering without layouts
(pc *Context, tpos math32.Vector2)
| 254 | // compute baseline offset and calls overall Render -- convenience for simple |
| 255 | // widget rendering without layouts |
| 256 | func (tr *Text) RenderTopPos(pc *Context, tpos math32.Vector2) { |
| 257 | if len(tr.Spans) == 0 { |
| 258 | return |
| 259 | } |
| 260 | sr := &(tr.Spans[0]) |
| 261 | if sr.IsValid() != nil { |
| 262 | return |
| 263 | } |
| 264 | curFace := sr.Render[0].Face |
| 265 | pos := tpos |
| 266 | pos.Y += math32.FromFixed(curFace.Metrics().Ascent) |
| 267 | tr.Render(pc, pos) |
| 268 | } |
| 269 | |
| 270 | // SetString is for basic text rendering with a single style of text (see |
| 271 | // SetHTML for tag-formatted text) -- configures a single Span with the |