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 3762 - Can't render characters with codepoints greater than 2^16
Summary: Can't render characters with codepoints greater than 2^16
Status: RESOLVED FIXED
Alias: None
Product: SDL_ttf
Classification: Unclassified
Component: misc (show other bugs)
Version: 2.0.13
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-19 19:24 UTC by heinrietman
Modified: 2017-09-10 05:21 UTC (History)
0 users

See Also:


Attachments
Test case (359.62 KB, application/gzip)
2017-08-19 19:24 UTC, heinrietman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description heinrietman 2017-08-19 19:24:39 UTC
Created attachment 2866 [details]
Test case

I was trying to create a program to render emoji using SDL_ttf, but it didn't work. After investigating the source code of SDL_ttf I figured out codepoints are represented using Uint16 which cannot represent the code points in the range used by emoji.

I attached a small test program which illustrates the problem.
Comment 1 Sam Lantinga 2017-09-10 04:37:26 UTC
I looked into this, and FreeType itself is rejecting the character:
    frame #0: 0x00000001002d6991 libfreetype.6.dylib`tt_cmap4_char_index(cmap=0x0000000100609970, char_code=128513) at ttcmap.c:1465
   1462	                       FT_UInt32  char_code )
   1463	  {
   1464	    if ( char_code >= 0x10000UL )
-> 1465	      return 0;

If I remove that line, it really can't find the character in the font character map.
Comment 2 Sam Lantinga 2017-09-10 04:47:26 UTC
If I open the font in Font Book, I can see the character, so I'm not sure how to get FreeType to see it.
Comment 3 Sam Lantinga 2017-09-10 05:05:02 UTC
I found the right character map to find the character, a fix is on the way!
Comment 4 Sam Lantinga 2017-09-10 05:21:04 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL_ttf/rev/31a3181ae289