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 2362 - Broken glyph rendering for both TTF_RenderUNICODE/UTF8 variants.
Summary: Broken glyph rendering for both TTF_RenderUNICODE/UTF8 variants.
Status: RESOLVED WONTFIX
Alias: None
Product: SDL_ttf
Classification: Unclassified
Component: misc (show other bugs)
Version: 2.0.11
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-25 02:42 UTC by robinds
Modified: 2014-02-02 10:16 UTC (History)
0 users

See Also:


Attachments
Big image on top is the output. Small image beneath is an example of correct rendering. (75.54 KB, image/jpeg)
2014-01-25 02:42 UTC, robinds
Details

Note You need to log in before you can comment on or make changes to this bug.
Description robinds 2014-01-25 02:42:48 UTC
Created attachment 1537 [details]
Big image on top is the output. Small image beneath is an example of correct rendering.

The main developer for the Kivy project stated in IRC that he believed that the problem might be located in FT_Get_Kerning(), where only delta.x is used and never delta.y.

My test code: https://github.com/ironhouzi/sdl2-sdl_ttf-test

The correct rendering is done on my system: Slackware 14.1, in the Konsole terminal emulator on KDE 4.10.5. The truetype font used is MS Himalaya, which is by far the most Unicode compliant font in existence which covers the address space used for the example. A download link is available in the Github repository.

In case the attachment didn't work:

Image of the output: http://imgur.com/vKLVpt1
Image of how it should be displayed: http://imgur.com/V0zS1rm


This is the output of the SDL_Version testing at the beginning of my code
:
compiled with SDL_ttf version: 2.0.12
running with SDL_ttf version: 2.0.11

Don't hesitate to contact me with any questions or requests. This is a complete show stopper for my project, so I will try to do everything I can to help the elimination of the bug.
Comment 1 robinds 2014-01-25 02:47:33 UTC
Using FreeType version 16.2.10
Comment 2 Sam Lantinga 2014-02-02 09:57:38 UTC
I checked the kerning, and delta.x and delta.y are both 0 for all characters in the string. The advance is 0 for the characters that stack upon one another, which is what I would expect.

Notice though that the glyph shape actually changes when they are composed in this way. I think the font system that KDE is using may actually be substituting glyphs for character sequences. ICU provides advanced functionality to do this sort of thing, but it's not included with SDL.

I could be totally wrong though. Can you confirm?
Comment 3 Sam Lantinga 2014-02-02 10:16:39 UTC
Doing more research, it looks like what you need is an OpenType shaping engine.

Searching around I found some examples of harfbuzz and SDL, which might be closer to what you need:
https://github.com/wutipong/drawtext-sdl2-freetype2-harfbuzz
https://github.com/wutipong/drawtext-sdl2-freetype2-harfbuzz/blob/master/sdl-ft-harfbuzz/main.cpp