NME Font Rendering

I notice FreeType has a new version out, which has some reasonable changes since a key patent has expired.

Version 2.3.9, Default
Version 2.3.9, AutoHinting
Version 2.4.4, Default
Version 2.4.4, AutoHinting
Flash (Mac)
GDI Threshold (Current)
GDI AA + Gamma
Flash (Windows)

So a few observations: The “Default Hinting” has changed quite a bit for TrueType fonts in the latest version. I think this code is what the expired patent related to, allowing the font-specific hinting data to be used. The “AutoHinting” mode is based on font-independent logic built into FreeType. The Flash renderer uses component based sub-pixel rendering, using RGB components to get finer details. The font also looks a bit “fatter”.

Currently NME uses a single set of bitmaps for the fonts, which must be used for all colours. This means that component based sub-pixel rendering is not really an option. However, it may be possible to sort something out (at the expense of more memory) if the need really arises. But also note, this is counter-productive in landscape mode on mobile devices.

On windows, NME currently uses GDI fonts with a threshold. I like the look of this (I spend most of my time on windows) for the small fonts, but it looks pretty bad on the larger fonts. Particularly note the exactly 1-pixel wide vertical lines in the “H” and the “l”, which I like. The larger fonts look much better with anti-aliasing on. However, windows applies some kind of gamma-correction when rendering fonts, and you get quite a different look for black-on-white and white-on-black. To work around this, I have applied a lookup-table to get a bitmap that will work for both light and dark.

Finally notice the windows flash renderer does not use AA with this swf (although the Mac version did).

In the next version, I will change windows over to use GDI + AA + Gamma. It is possible to use FreeType, but I think the font is slightly less readable at the smaller sizes. What do you think?

This entry was posted in flash, nme, Result and tagged , , , , , , . Bookmark the permalink.

3 Responses to NME Font Rendering

  1. Matt Braun says:

    It appears the currently included version of FreeType isn’t working on iOS. In particular, this error crops up: Primitive not found : freetype_import_font__3.
    Wondering if you have any ideas on how to fix this?


  2. Matt Braun says:

    After some more investigation, it appears FreeType was removed for iOS target. I’m curious about the reason?

  3. Huge says:

    Hi Matt,
    Sorry this is a bit late, but the idea was to use the native font code to save on space and give a font look consistent with the platform. The ios native stuff is a bit of a pain (really painful in fact), and I might consider putting freetype back in if I need to get rotated/stroked fonts going properly. Possibly with an option to switch between them.

Leave a Reply

Your email address will not be published. Required fields are marked *