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

Method RenderTopPos

paint/text.go:256–268  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

254// compute baseline offset and calls overall Render -- convenience for simple
255// widget rendering without layouts
256func (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

Callers

nothing calls this directly

Calls 3

RenderMethod · 0.95
FromFixedFunction · 0.92
IsValidMethod · 0.45

Tested by

no test coverage detected