static void draw_string()

in ev3-api/src/ev3api_lcd.c [209:230]


static void draw_string(const char *str, int32_t x, int32_t y, font_t *font) {
    bitmap_t *question = utf8_char_bitmap('?', font); // For default
    assert(question != NULL);

    while(*str != '\0') {
        uint32_t codepoint;
        if (!(*str & 0x80)) {
            codepoint32_t = *str;
            str++;
        } else { // High UTF-8 code point, not support yet
            assert(false);
            codepoint32_t = *str;
            str++;
        }

        bitmap_t *bitmap = utf8_char_bitmap(codepoint, font);
        if (bitmap == NULL) bitmap = question; // Fall-back

        bitBlt(bitmap, 0, 0, lcd_screen, x, y, bitmap->width, bitmap->height, ROP_COPY);
        x += bitmap->width;
    }
}