MCPcopy
hub / github.com/mum4k/termdash / drawChar

Method drawChar

widgets/segmentdisplay/segmentdisplay.go:272–292  ·  view source on GitHub ↗

drawChar draws a single character onto the provided canvas.

(dCvs *canvas.Canvas, c rune, wOpts *writeOptions)

Source from the content-addressed store, hash-verified

270
271// drawChar draws a single character onto the provided canvas.
272func (sd *SegmentDisplay) drawChar(dCvs *canvas.Canvas, c rune, wOpts *writeOptions) error {
273 if sd.dotChars[c] {
274 disp := dotseg.New()
275 if err := disp.SetCharacter(c); err != nil {
276 return fmt.Errorf("dotseg.Display.SetCharacter => %v", err)
277 }
278 if err := disp.Draw(dCvs, dotseg.CellOpts(wOpts.cellOpts...)); err != nil {
279 return fmt.Errorf("dotseg.Display..Draw => %v", err)
280 }
281 return nil
282 }
283
284 disp := sixteen.New()
285 if err := disp.SetCharacter(c); err != nil {
286 return fmt.Errorf("sixteen.Display.SetCharacter => %v", err)
287 }
288 if err := disp.Draw(dCvs, sixteen.CellOpts(wOpts.cellOpts...)); err != nil {
289 return fmt.Errorf("sixteen.Display.Draw => %v", err)
290 }
291 return nil
292}
293
294// Keyboard input isn't supported on the SegmentDisplay widget.
295func (*SegmentDisplay) Keyboard(k *terminalapi.Keyboard, meta *widgetapi.EventMeta) error {

Callers 1

DrawMethod · 0.95

Calls 6

NewFunction · 0.92
CellOptsFunction · 0.92
NewFunction · 0.92
CellOptsFunction · 0.92
DrawMethod · 0.65
SetCharacterMethod · 0.45

Tested by

no test coverage detected