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 - Typo in TTF_RenderUTF8_Solid
Summary: Typo in TTF_RenderUTF8_Solid
Status: RESOLVED FIXED
Alias: None
Product: SDL_ttf
Classification: Unclassified
Component: misc (show other bugs)
Version: 2.0.10
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-11 03:27 UTC by Tobias Leich
Modified: 2010-03-25 02:08 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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