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 2492

Summary: Asian language support for SDL_ttf-2.0.12 (fix)
Product: SDL_ttf Reporter: George Wu <micstu>
Component: miscAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2 CC: philipp.wiesemann, sylvain.becker
Version: unspecified   
Hardware: All   
OS: All   
Attachments: The fixed TTF_RenderUTF8_Blended_Wrapped() function

Description George Wu 2014-04-12 06:29:24 UTC
Created attachment 1616 [details]
The fixed TTF_RenderUTF8_Blended_Wrapped() function

A fix for bug 2486, solving the crash problem when trying to draw English characters.
#Description:
Removed several SDL_stack_free() (SDL_free()) calls since I have changed the usage of variable 'str'. See comments in code.
#Remarks
Robustness and optimization are not assured. (Sorry but I am a newbie.)
#Known issues:
The character width calculation function utilGetGlyphWidthis still not working properly.
Comment 1 Philipp Wiesemann 2014-04-13 19:05:00 UTC
The new version of utilGetGlyphWidth() is missing for this fix to be useful. In bug 2486 it has only two parameters instead of three.
Comment 2 George Wu 2014-04-14 02:24:06 UTC
(In reply to Philipp Wiesemann from comment #1)
> The new version of utilGetGlyphWidth() is missing for this fix to be useful.
> In bug 2486 it has only two parameters instead of three.

The parameter 'ch' is a dummy one, at least in current version of code. Thanks for figuring out.
Comment 3 George Wu 2014-05-04 01:28:57 UTC
I checked the code yesterday and found several spelling mistakes in comments, sorry.
By the way, I still don't get the right way to measure a glyph. I thought that maxx minx means the real width of a glyph (as shown in utilGetGlyphWidth()), which in fact is glyph->advance - glyph->minx or glyph->maxx - glyph->minx, but it works awful in my test cases. But how can it work in TTF_SizeUTF8()?
The conclusion is that, the right delimition of characters, including Western and Asian ones, is completed. However, measuring them is still a problem.
Comment 4 Sylvain 2019-01-31 14:03:47 UTC
For complex text shaping you may want either:

Bug 3211 - Complex text layout support
Bug 3046 - SDL_ttf + HarfBuzz
Comment 5 Sylvain 2019-10-23 09:15:18 UTC
So this is fixed with previous patches