MCPcopy Index your code
hub / github.com/endbasic/endbasic / draw_text

Function draw_text

std/src/console/drawing.rs:411–421  ·  view source on GitHub ↗

Writes a single character `ch` at `pos`.

(rasops: &mut R, font: &Font, xy: PixelsXY, text: &str)

Source from the content-addressed store, hash-verified

409
410/// Writes a single character `ch` at `pos`.
411pub fn draw_text<R>(rasops: &mut R, font: &Font, xy: PixelsXY, text: &str) -> io::Result<()>
412where
413 R: RasterOps,
414{
415 let mut pos = xy;
416 for ch in text.chars() {
417 draw_char(rasops, font, pos, ch)?;
418 pos.x += i16::try_from(font.glyph_size.width).expect("Must fit");
419 }
420 Ok(())
421}
422
423/// Draws a triangle via `rasops`.
424pub fn draw_tri<R>(rasops: &mut R, x1y1: PixelsXY, x2y2: PixelsXY, x3y3: PixelsXY) -> io::Result<()>

Callers 6

write_textMethod · 0.85
test_draw_text_emptyFunction · 0.85
test_draw_text_one_charFunction · 0.85
test_draw_text_two_charsFunction · 0.85
write_textMethod · 0.85
write_textMethod · 0.85

Calls 2

draw_charFunction · 0.85
charsMethod · 0.80

Tested by 3

test_draw_text_emptyFunction · 0.68
test_draw_text_one_charFunction · 0.68
test_draw_text_two_charsFunction · 0.68