From 3a9fcbedda7e7b10d6f5b0a2fd9ed873b2a70cdb Mon Sep 17 00:00:00 2001 From: Pablo Saratxaga Date: Sat, 16 Aug 2003 21:58:02 +0000 Subject: Added real i18n support (different fonts possible, depending on language) --- fbtruetype/ttf.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'fbtruetype/ttf.c') diff --git a/fbtruetype/ttf.c b/fbtruetype/ttf.c index 61ee3b0..2c64121 100644 --- a/fbtruetype/ttf.c +++ b/fbtruetype/ttf.c @@ -114,7 +114,6 @@ static unsigned short *ASCII_to_UNICODE(unsigned short *unicode, const char *tex return unicode; } -#if 0 static unsigned short *UTF8_to_UNICODE(unsigned short *unicode, const char *utf8, int len) { int i, j; @@ -143,7 +142,6 @@ static unsigned short *UTF8_to_UNICODE(unsigned short *unicode, const char *utf8 return unicode; } -#endif /* TTF stuff */ @@ -182,14 +180,14 @@ SDL_Surface *TTF_RenderText_Solid(TTF_Font *font, Uint16 *unicode_text; int unicode_len; - /* Copy the Latin-1 text to a UNICODE text buffer */ + /* Copy the UTF-8 text to a UNICODE text buffer */ unicode_len = strlen(text); unicode_text = (Uint16 *)malloc((unicode_len+1)*(sizeof *unicode_text)); if ( unicode_text == NULL ) { TTF_SetError("Out of memory"); return(NULL); } - ASCII_to_UNICODE(unicode_text, text, unicode_len); + UTF8_to_UNICODE(unicode_text, text, unicode_len); RenderUnicode(font, unicode_text, fg); @@ -208,7 +206,7 @@ unsigned char*TTF_RenderText_Shaded(TTF_Font *font, const char *text, unsigned i unsigned short *unicode_text; int unicode_len; - /* Copy the Latin-1 text to a UNICODE text buffer */ + /* Copy the UTF-8 text to a UNICODE text buffer */ unicode_len = strlen(text); unicode_text = (unsigned short *)malloc((unicode_len+1)*(sizeof *unicode_text)); @@ -216,7 +214,7 @@ unsigned char*TTF_RenderText_Shaded(TTF_Font *font, const char *text, unsigned i printf("Out of memory\n"); return(NULL); } - ASCII_to_UNICODE(unicode_text, text, unicode_len); + UTF8_to_UNICODE(unicode_text, text, unicode_len); /* Render the new text */ textbuf = TTF_RenderUNICODE_Shaded(font, unicode_text, fg, bg); @@ -762,7 +760,7 @@ int rendertext(char *text, char *fontname, unsigned int ptsize, unsigned int for } renderstyle = TTF_STYLE_NORMAL; - rendertype = RENDER_LATIN1; + rendertype = RENDER_UTF8; TTF_SetFontStyle(font, renderstyle); text = TTF_RenderText_Shaded(font, text, forecol, 0); -- cgit v1.2.1