[ft] iOS 7 system font Helvetica Neue horribly mis-hinted with FreeType 2.5.3
2014-08-12 16:41:33 GMT
Thank you so much for the open source miracle that is FreeType.
I really hope I am doing something simple wrong here, because there must be thousands of iOS app vendors trying the same thing every day. It seems all OpenGL iOS apps would want to do just what I am doing here. Also, if indeed iOS uses FreeType for its own rendering, then this should definitely work ?!?!
I have some absolutely minimal FreeType code that just tries to render simple A-Z glyphs with the iOS system font, "Helvetica Neue Interface."
I am seeing FT results that are horribly disfigured like the attached file bad_hinting.png or you can see the same image here:
As you can see, random character strokes are thick and random strokes are thin, as if FT were trying to fit my text to some coarse grid.
I ONLY see this disfigurement with the iOS Helvetica fonts (_H_Helvetica.ttc, _H_HelveticaNeue.ttc, _H_HelveticaNeueInterface.ttc). Many other fonts are OK with my code including Arial Unicode MS, several Chinese fonts, Segoe UI, and several of the Google fonts like Noto.
I ONLY see the disfigurement if I use the TrueType bytecode hinter inside FT. I do not see the disfigurement with FT auto-hinting or with hinting disabled.
Note these fonts do not contain any 'gasp' table.
My test is at 39 pixel em size. If I choose MUCH smaller sizes, I see even more extreme distortions, like for example the whole middle segment of a lowercase 'a' disappears. If you like I can send more sample pix.
For testing purposes, you can download a sample font that shows the problem here: http://s000.tinyupload.com/index.php?file_id=45977206462678571206
The testing font is a .ttc containing 7 .ttfs. You can use any of the .ttfs to see the problem; I used the first .ttf in my test.
My code is essentially this (yes, my real code checks all error return values):
FT_Library library = ft_get_library();
FT_New_Face(library, filename, ttc_slot /*0*/, &ff.ft_face );
FT_Set_Pixel_Sizes(ff.ft_face, 39, 39);
FT_LOAD_RENDER | // create actual bitmap!
If I use FT_LOAD_FORCE_AUTOHINT or if I use FT_LOAD_NO_HINTING, the output I get is nice (a bit fuzzy). But if I use FreeType's native TTF bytecode hinter by passing neither of those options, things go wonky as above.
I still get the same problem if I try to use FT_LOAD_NO_BITMAP and/or FT_LOAD_IGNORE_TRANSFORM.
p.s. before someone hijacks this thread by asking an unrelated question: although iOS apps cannot directly open the system .ttf/.ttc font files due to Apple fascism, it IS possible for an app to legally suck over all the bits of a TrueType file into its memory, as explained at http://stackoverflow.com/questions/3692812/on-ios-can-i-access-the-system-provided-fonts-ttf-file and I'm sure thousands of OpenGL apps do this. But this is not relevant to my question: the bug/problem I am explaining here happens even if you root your phone and open the font file directly, and even if you copy the .ttc file to a Windows computer and run FreeType there.
_______________________________________________ Freetype mailing list Freetype <at> nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype