issue #1054, fixed 1x2 and 2x2 procedures for big 8x8 fonts
This commit is contained in:
parent
d9c4151955
commit
5ff1f15dbc
|
@ -399,6 +399,10 @@ static uint8_t u8x8_draw_2x2_string(u8x8_t *u8x8, uint8_t x, uint8_t y, const ch
|
|||
{
|
||||
uint16_t e;
|
||||
uint8_t cnt = 0;
|
||||
uint8_t th = u8x8_pgm_read(u8x8->font+2); /* new 2019 format */
|
||||
|
||||
th <<= 1;
|
||||
|
||||
u8x8_utf8_init(u8x8);
|
||||
for(;;)
|
||||
{
|
||||
|
@ -409,7 +413,7 @@ static uint8_t u8x8_draw_2x2_string(u8x8_t *u8x8, uint8_t x, uint8_t y, const ch
|
|||
if ( e != 0x0fffe )
|
||||
{
|
||||
u8x8_Draw2x2Glyph(u8x8, x, y, e);
|
||||
x+=2;
|
||||
x+=th;
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
@ -433,9 +437,10 @@ uint8_t u8x8_Draw2x2UTF8(u8x8_t *u8x8, uint8_t x, uint8_t y, const char *s)
|
|||
|
||||
static uint8_t u8x8_draw_1x2_string(u8x8_t *u8x8, uint8_t x, uint8_t y, const char *s) U8X8_NOINLINE;
|
||||
static uint8_t u8x8_draw_1x2_string(u8x8_t *u8x8, uint8_t x, uint8_t y, const char *s)
|
||||
{
|
||||
{
|
||||
uint16_t e;
|
||||
uint8_t cnt = 0;
|
||||
uint8_t th = u8x8_pgm_read(u8x8->font+2); /* new 2019 format */
|
||||
u8x8_utf8_init(u8x8);
|
||||
for(;;)
|
||||
{
|
||||
|
@ -446,7 +451,7 @@ static uint8_t u8x8_draw_1x2_string(u8x8_t *u8x8, uint8_t x, uint8_t y, const ch
|
|||
if ( e != 0x0fffe )
|
||||
{
|
||||
u8x8_Draw1x2Glyph(u8x8, x, y, e);
|
||||
x++;
|
||||
x+=th;
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
CFLAGS = -g -Wall -I../../../csrc/. `sdl2-config --cflags`
|
||||
|
||||
SRC = $(shell ls ../../../csrc/*.c) $(shell ls ../common/*.c ) main.c
|
||||
|
||||
OBJ = $(SRC:.c=.o)
|
||||
|
||||
helloworld: $(OBJ)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) `sdl2-config --libs` -o u8g2_sdl
|
||||
|
||||
clean:
|
||||
-rm $(OBJ) u8g2_sdl
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#include "u8x8.h"
|
||||
|
||||
u8x8_t u8x8;
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
u8x8_Setup_SDL_128x64(&u8x8);
|
||||
u8x8_InitDisplay(&u8x8);
|
||||
|
||||
u8x8_SetFont(&u8x8, u8x8_font_px437wyse700a_2x2_r);
|
||||
u8x8_SetFont(&u8x8, u8x8_font_courB24_3x4_f);
|
||||
|
||||
|
||||
//u8x8_DrawString(&u8x8, 0, 0, "abc");
|
||||
//u8x8_Draw1x2String(&u8x8, 0, 4, "abc");
|
||||
u8x8_Draw2x2String(&u8x8, 0, 0, "Abcd");
|
||||
|
||||
|
||||
while( u8g_sdl_get_key() < 0 )
|
||||
;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue