20 Jun 2012 00:00
TTF_RenderUTF8 with non-UTF8 character
David Demelier <demelier.david <at> gmail.com>
2012-06-19 22:00:30 GMT
2012-06-19 22:00:30 GMT
Hello, I'm just wondering why TTF_RenderUTF8 does not support printing characters that are not (I support UTF8). My problem, I used gettext to write some french on my screen, my drawing functions always use TTF_RenderUTF8 and it works, my text that contains some accents like 'é' 'ç' 'à' are written correctly. However, if I wait for user input, I try to fill a char buffer and print it on the screen (e.g let the user write his name). So I read the SDL_keysym unicode member and add it to the buffer, but then when using TTF_RenderUTF8, the output is broken, only squares are written (like missing characters).. In fact, when I press a key like 'a', 'b' the unicode member will be set to the ASCII character (normal) but it will also set it for 'é' which value is 233, that's probably why I get a bad font rendering. Please try my source code just below, put this font directly in the same directory as the executable: -- font -- http://markand.malikania.fr/DejaVuSans.ttf -- code -- #include <stdio.h> #include <stdbool.h> #include <err.h>(Continue reading)
RSS Feed