I'm not entirely sure this is the best place for this, but I can't think of anywhere better
I've "made" a low resolution font. (bonus points if you know where it's actually from)
The font works fine in gedit:
However, when trying to render the font with SDL_ttf, it mostly works, except for some multibyte unicode characters (notably 'æ' and '℃') while other non-ASCII characters work fine. But(!), all of these characters work fine with other fonts (I've been using DejaVu Sans)
The fact that other fonts work fine suggest that the code is not to blame, but just in case:
SDL_Surface *surf = TTF_RenderUTF8_Solid(this->font, (const char *)text, col);
if (surf == nullptr) {
fprintf(stderr, "Rendering text failed (%s)\n", TTF_GetError());
return;
}
if (surf->format->BitsPerPixel != 8 || surf->format->BytesPerPixel != 1) {
fprintf(stderr, "Rendering text failed (Wrong surface format)\n");
return;
}
(text is const uint8*) None of these errors are triggered, obviously
I've noticed that these 2 characters in particular are wider than the rest, could this be to blame?
Per comment below, the font seems to work fine with the SDL_TTF "latin-1" demo:
I.. I don't know what was wrong. I just tried it again, and it worked fine.
I was so sure I'd checked that I was using the correct font.. Or maybe I changed something when I generated it
Thanks for the help regardless :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With