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

Method SetStringRot90

paint/text.go:296–309  ·  view source on GitHub ↗

SetStringRot90 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 TB rotated layout (-90 deg). Be sure that OpenFont has been run so a valid Face is available. noBG ignores any BackgroundColor in f

(str string, fontSty *styles.FontRender, ctxt *units.Context, txtSty *styles.Text, noBG bool, scalex float32)

Source from the content-addressed store, hash-verified

294// Be sure that OpenFont has been run so a valid Face is available.
295// noBG ignores any BackgroundColor in font style, and never renders background color
296func (tr *Text) SetStringRot90(str string, fontSty *styles.FontRender, ctxt *units.Context, txtSty *styles.Text, noBG bool, scalex float32) {
297 if len(tr.Spans) != 1 {
298 tr.Spans = make([]Span, 1)
299 }
300 tr.Links = nil
301 sr := &(tr.Spans[0])
302 rot := float32(math32.Pi / 2)
303 sr.SetString(str, fontSty, ctxt, noBG, rot, scalex)
304 sr.SetRunePosTBRot(txtSty.LetterSpacing.Dots, txtSty.WordSpacing.Dots, fontSty.Face.Metrics.Ch, txtSty.TabSize)
305 ssz := sr.SizeHV()
306 vht := fontSty.Face.Face.Metrics().Height
307 tr.BBox.Min.SetZero()
308 tr.BBox.Max = math32.Vec2(math32.FromFixed(vht), ssz.Y)
309}
310
311// SetRunes is for basic text rendering with a single style of text (see
312// SetHTML for tag-formatted text) -- configures a single Span with the

Callers 2

SizeLabelMethod · 0.95
RenderMethod · 0.95

Calls 6

Vec2Function · 0.92
FromFixedFunction · 0.92
SetRunePosTBRotMethod · 0.80
SizeHVMethod · 0.80
SetStringMethod · 0.65
SetZeroMethod · 0.45

Tested by

no test coverage detected