TD renderer — an attempt to simulate classic GDI

Applications using FreeType are absolutely everywhere, yet it is so frustrating how much worse they render than classic GDI. That exact-area anti-aliasing algorithm that produces results too smooth, failing to use horizontal hinting, failing to clip vertically, failing to disable anti-aliasing, failing to use correct gamma, you name it. FreeType is very commonly misused. Therefore TD renderer (C++) attempts to remedy those issues. TD renderer is the Type Design renderer. It relies on FreeType, but it uses its own rasterizer to properly clip the output vertically (as any reasonable TrueType renderer should) and anti-alias it with 4×4 oversampling if allowed by the gasp table.

Examples (version 2.0), compared with classic GDI:


DMCA Sans Serif 9.0-20252 — the 4×4 oversampling is indeed quite aesthetic. (version 1.0 is pixel-for-pixel identical)


Microsoft Arial — because dropout control is extremely complicated, it is currently extremely glitchy in TD renderer. In 1.0 it didn't even have the right heuristics implemented to do dropout control properly, now in 2.0 it is similar to FreeType: following the general standard but not the proper rounding. (version 1.0: https://i.imgur.com/uoLOuaj.png )


Microsoft Consolas — Ok so I'll discuss what's happening here. The ClearType optimized fonts are coded to completely break when they detect standard grayscale rendering. Using bilevel outlines instead gets the proper hinting as is in the font. Some other fonts use some weird VTT feature where the rounding occurs conditionally depending on the anti-aliasing, effectively breaking anti-aliased rendering — using bilevel outlines fixes this too. I don't think adding code to get grayscale rendering outlines achieves anything meaningful, as it seems that in every font where it makes a difference, it makes the rendering worse. (version 1.0: https://i.imgur.com/yPid757.png — one pixel difference in 'g' in 8ppem)


Riglos Mono 1.1 — Autohinter is of course disabled because there isn't ttfautohint in GDI. It does utilize the embed bitmaps (sizes 9 to 23) when possible, but doesn't clip horizontally the same way as GDI. I had to make sure to disable the autohinter before any release to achieve meaningful results. (version 1.0: https://i.imgur.com/HY8NXnf.png — note the half pixel glitches)

3.0

The above examples are shown in version 2.0, but version 3.0 further improves the accuracy of the renderer. Includes additional heuristics for missing extrema to fix a few glitchy renders, as well as fixing glitchy dropout control point order dependency and glitchy top and right boundary checks in dropout control. TD renderer 3.0 also has features like the ability to use tdr_face as a type (like originally in FreeType) to faciliate multifonttasking, and custom oversampling rates. The experimental FreeType rasterizer testing tool now supports the ability to use 4×4 oversampling, but it is recommended to use the TD renderer rasterizer instead, due to properly handling half pixel lines and dropout control processing order. TD renderer is intended to make the wonders of classic GDI rendering accessible to any open-source software by porting the renderer, allowing to build on such as by making a text editor that simulates Microsoft Notepad. Looking forward to criticism and if you find ways to improve the renderer accuracy, immediately go to the Contact section below.

Downloads

tdrenderer-3.0.zip

Older downloads:
tdrenderer-2.0.zip
tdrenderer-1.0.zip

Contact

Name: Piotr Grochowski
E-mail: piotrunio-2004@wp.pl
Comments:
Widget is loading comments...