[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] rendering wide unicode characters?



On Thu, 2005-12-08 at 16:26 +1100, Anthony Baxter wrote:
> The following script _should_ render a large unicode character of the
> Clef symbol. You'll need Arial Unicode MS installed to test it, or any 
> other complete unicode font (this is the only one I know of)
> 
> Instead, I get a large chinese character. Is there a problem with SDL,
> or pygame, or am I just missing something? It tries to pass the raw 
> unicode character, the UTF8 and UTF16 encoded versions. This is with 
> pygame 1.7.1release on Ubuntu 05.10 (Breezy). 

I would write this in straight SDL and SDL_ttf. Pygame just passes the
unicode characters to SDL_ttf, but I am never sure if they are speaking
the same unicode dialect.

SDL_ttf has two functions for this. Pygame is always using the UTF8
version.

SDL_Surface* TTF_RenderUTF8_Solid(TTF_Font *font,
                                const char *text, SDL_Color fg);
SDL_Surface*  TTF_RenderUNICODE_Solid(TTF_Font *font,
                                const Uint16 *text, SDL_Color fg);