[1.2+OpenGL]-SDL_TTF-Display (C) & (R) Characters Linux? |
[1.2+OpenGL]-SDL_TTF-Display (C) & (R) Characters Linux? |
Bill Kendrick
Guest
|
On Fri, May 28, 2010 at 06:57:45AM -0700, JeZ-l-Lee wrote:
Try using UTF-8-enabled rendering, e.g. TTF_RenderUTF8_Blended() (This is from my experience with straight SDL + SDL_ttf or SDL + SDL_Pango, with no OpenGL involved... but I assume that shouldn't matter ) -bill! _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
[1.2+OpenGL]-SDL_TTF-Display (C) & (R) Characters Linux? |
JeZ-l-Lee
|
On Fri, 2010-05-28 at 15:43 -0700, Bill Kendrick wrote:
Hi, Thanks for the suggestion, but it did not solve the problem. Still have problem drawing (C) and (R) characters using SDL1.2+OpenGL+SDL_TTF Anyone have any ideas? Jesse _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||
|
[1.2+OpenGL]-SDL_TTF-Display (C) & (R) Characters Linux? |
Andy Hefner
Guest
|
It looks like your source code is saved UTF-8 encoding. If you open it
in a hex editor I think you'll see that the extra characters you're complaining about are present in the file. Saving the file in a different encoding, like ISO 8859-1 (latin-1) would fix it. Alternatively, keep your text pure ASCII and insert special symbols such as these via printf using the %c conversion and their character codes (0xA9 and 0xAE). _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||
|
Re: [1.2+OpenGL]-SDL_TTF-Display (C) & (R) Characters Li |
JeZ-l-Lee
|
I tried what you suggested, but it is not working for me. The source compiles fine, but when I run it it crashes:
How I fix this problem, thanks! Jesse |
|||||||||||||||
|
[1.2+OpenGL]-SDL_TTF-Display (C) & (R) Characters Linux? |
Crystal Jacobs
Guest
|
On Sat, 29 May 2010, JeZ-l-Lee wrote:
You're not allocating memory for these strings. Of course, you don't need to do it that way at all. You can create a string this way instead: char copy[] = "\xA9";
This dereferences null pointers, which crashes.
How about: strcpy(visuals->VariableText, "\xA9opyright 2010, by 16BitSoft\xAE"); (Or strncpy or something safer with the proper sizes, but you get the idea. I don't actually know the definition of visuals, here, since it's not a complete code sample.)
-Crystal _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||||||||
|
[1.2+OpenGL]-SDL_TTF-Display (C) & (R) Characters Linux? |
Andy Hefner
Guest
|
Try something like this:
char message[256]; sprintf(message, "%copyright 2010, By 16BitSoft%c", 0xA9, 0xAE); visuals->DrawTextOntoScreenBuffer(message, visuals->FontDefault[0], 0, 420, JustifyCenter, 255, 255, 255, 90, 90, 90); Normally I'd use snprintf, but Visual C++ renames it to _snprintf or something, so I stuck with sprintf which is available everywhere. If really need a copy in visuals->VariableText, add: visuals->VariableText = strdup(message); _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||
|