tuupola / hagl

Hardware Agnostic Graphics Library for embedded
https://www.appelsiini.net/tags/hagl/
MIT License
293 stars 47 forks source link

Why does text come out so small? #114

Closed oschettler closed 8 months ago

oschettler commented 8 months ago

Thank you for this wonderful project. I try to run some of the examples and wonder why text comes out so small, e.g.

image

Console output:

Allocated back buffer to address 0x7fdad9500000.
w=320, h=240
w=6

This is the code:

hagl_backend_t *display = hagl_init();
printf("w=%d, h=%d\n", display->width, display->height);
grid(display); // code omitted
uint16_t w = hagl_put_text(display, (const wchar_t *)u"Schön bunt hier", 20, display->height / 2.0, 0xffff, font6x9);
printf("w=%d\n", w);
oschettler commented 8 months ago

Ah, I've found out myself. It is a matter of getting the parameter type right. With...

uint16_t w = hagl_put_text(display, L"Schön bunt hier.", x0, y0, color, font6x9);

It comes out with w=96 and the text shown as expected:

image