void ICACHE_FLASH_ATTR u8g_DrawCursor(u8g_t *u8g) { const u8g_pgm_uint8_t *font; uint8_t color; uint8_t encoding = u8g->cursor_encoding; /* get current values */ color = u8g_GetColorIndex(u8g); font = u8g->font; /* draw cursor */ u8g->font = u8g->cursor_font; encoding++; u8g_SetColorIndex(u8g, u8g->cursor_bg_color); /* 27. Jan 2013: replaced call to u8g_DrawGlyph with call to u8g_draw_glyph */ /* required, because y adjustment should not happen to the cursor fonts */ u8g_draw_glyph(u8g, u8g->cursor_x, u8g->cursor_y, encoding); encoding--; u8g_SetColorIndex(u8g, u8g->cursor_fg_color); /* 27. Jan 2013: replaced call to u8g_DrawGlyph with call to u8g_draw_glyph */ /* required, because y adjustment should not happen to the cursor fonts */ /* u8g_DrawGlyph(u8g, u8g->cursor_x, u8g->cursor_y, encoding); */ u8g_draw_glyph(u8g, u8g->cursor_x, u8g->cursor_y, encoding); /* restore previous values */ u8g->font = font; u8g_SetColorIndex(u8g, color); }
/* still used by picgen.c, dir argument is ignored */ int8_t u8g_DrawGlyphFontBBX(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, uint8_t dir, uint8_t encoding) { x -= u8g_GetFontBBXOffX(u8g); y += u8g_GetFontBBXOffY(u8g); u8g_draw_glyph(u8g, x, y, encoding); return 0; }
u8g_uint_t u8g_DrawStr(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, const char *s) { u8g_uint_t t = 0; int8_t d; y += u8g->font_calc_vref(u8g); while( *s != '\0' ) { d = u8g_draw_glyph(u8g, x, y, *s); x += d; t += d; s++; } return t; }
u8g_uint_t u8g_DrawStr(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, const char *s) { u8g_uint_t t = 0; int8_t d; //u8g_uint_t u8g_GetStrWidth(u8g, s); //u8g_font_GetFontAscent(u8g->font)-u8g_font_GetFontDescent(u8g->font); y += u8g->font_calc_vref(u8g); while( *s != '\0' ) { d = u8g_draw_glyph(u8g, x, y, *s); x += d; t += d; s++; } return t; }
u8g_uint_t u8g_DrawStrP(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, const u8g_pgm_uint8_t *s) { u8g_uint_t t = 0; int8_t d; uint8_t c; y += u8g->font_calc_vref(u8g); for(;;) { c = u8g_pgm_read(s); if ( c == '\0' ) break; d = u8g_draw_glyph(u8g, x, y, c); x += d; t += d; s++; } return t; }
int8_t u8g_DrawGlyph(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, uint8_t encoding) { y += u8g->font_calc_vref(u8g); return u8g_draw_glyph(u8g, x, y, encoding); }