We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 970

Summary: Typo in TTF_RenderUTF8_Solid
Product: SDL_ttf Reporter: Tobias Leich <email>
Component: miscAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: email
Version: 2.0.10   
Hardware: All   
OS: All   

Description Tobias Leich 2010-03-11 03:27:50 UTC
Hi there, I actually do the bindings for SDL_perl to SDL_ttf and have noticed a bug.

In TTF_RenderUTF8_Solid the BOM is set to the first Uint16, but in the following line it gets overwritten.

Patch (like the other UTF8 functions already do):

================================================================================
diff --git a/SDL_ttf.c b/SDL_ttf.c
index 2a7d6f5..66fb19d 100644
--- a/SDL_ttf.c
+++ b/SDL_ttf.c
@@ -1288,7 +1288,7 @@ SDL_Surface *TTF_RenderUTF8_Solid(TTF_Font *font,
 		return(NULL);
 	}
 	*unicode_text = UNICODE_BOM_NATIVE;
-	UTF8_to_UNICODE(unicode_text, text, unicode_len);
+	UTF8_to_UNICODE(unicode_text+1, text, unicode_len);
 
 	/* Render the new text */
 	textbuf = TTF_RenderUNICODE_Solid(font, unicode_text, fg);
================================================================================

Cheers, Tobias Leich
Comment 1 Sam Lantinga 2010-03-25 02:08:28 UTC
This is fixed for the next release, thanks!
http://hg.libsdl.org/SDL_ttf/rev/d8d6a6d3cc73