Google and Adobe Contribute Open Source Rasterizer to FreeType
alancronin writes with this excerpt from a PC World article: "Users of Android, Chrome OS, Linux, and iOS devices may not realize it, but FreeType open source software is used to render fonts on more than a billion such devices. Not only that, but the FreeType project this week got a significant update from none other than Adobe and Google. Specifically, Google and Adobe on Wednesday released into beta the Adobe CFF engine, an advanced Compact Font Format (CFF) rasterizer that 'paves the way for FreeType-based platforms to provide users with richer and more beautiful reading experiences,' as Google put it in an online announcement on the Google Open Source Blog. The new rasterizer is now included in FreeType version 2.4.12. Though it's currently off by default, the technology is 'vastly superior' to the old CFF engine and will replace it in the next FreeType release, the project says." The article features examples of how the new engine improves font rendering; for more explanation of the CFF, see this blog post from Adobe.
patent encumbered. That is probably what will happen next: some troll will rise up and sue one of the three parties for infringement. With as backdrop: "we don't want to be competed against by a "free" (as in beer - they don't get the speech part) product.". Let's hope that won't happen.
The big headache with rendering CFF is the hinting. I just ignored the hints, which gave okay result with 12+ font sizes. But without proper hinting small font sizes quickly become unclear.
CFF is very similar to Type1 fonts, so presumably this will also result in better looking Type1 fonts. Basically CFF is a compact way of storing Type1 fonts. I particularly liked how the CFF container format works. It almost parses itself, type1 fonts take more effort to parse, and true type fonts take a lot more effort to parse (but non-hinted true type rendering is OTOH super easy.)
CC.
TaijiQuan (Huang, 5 loosenings)
Can't wait for this to be rolled into a Linux distro. :)
People seem to obsess about fonts to the nth degree. Who really cares? The actual visible differences between fonts today and the bitmapped fonts of the 1984 mac classic are minimal and the amount of code generating todays fonts is way out of proportion with the actual improvements in their look. The law of diminishing returns doesn't even begin to describe it.
Freetype's Truetype rasterizer is heinous.
Here, let me explain why.
Microsoft's rasterizer for truetype uses a % coverage estimation to determine if a given pixel should be colored or not. It bases this using a sub pixel calculation, since each pixel has a theoretical 16x16 grid. This gives 256 possible values for subpixel coverage. Microsoft's implementation assigns a granularity of 16 shades of grey, where Freetype, in their faulted "MORE IS BETTERER! DERP!" wisdom assign a full 256 shades of grey.
This is BAD. VERY BAD. BAD. No, More shades of grey does NOT make crisper lines. NO. BAD.
Here is why:
Truetype instructions arent always subpixel perfect in where they move a curve's control point. Dropping the granularity to 16 shades of grey allows a certain degree of "forgiveness" if a curve crosses part of a pixel that you want to keep a certain shade. Noteworthy instances are the dots above letter "i", or under an "!", or the whitespace inside a letter "A", especially at small sizes. This forgiveness is reciprocal; you dont need a full 100% coverage to have black, (in the case of dots above i and under !. This is important, because the glyph geometry may have a circle for the vectoral line of these features, which simply cant cover 100% of the pixel without crossing into the subpixel space of adjacent pixels. Unless the point is a perfect square, you cant really hint 100% coverage at tiny sizes with TTF hint programs. This means your choices with freetype are: A square point, a black point with fuzzy around it, or a fuzzy grey point. With MS's rendering method, you get: A black pixel, with no fuzz.), just like you dont need 0% coverage to have transparent in the whitespace of the letter A. Freetype's programmers seem quite bullheaded about this, and insist that 256 color shading is somehow an improvement, rather than undesirable. This manifests profoundly with truetype CJK type glyphs for kanji characters, italicized characters, and the like. Freetype will "blur" an edge you dont want blurred, simply because you cant keep the vector out of the subpixel space of that pixel. This is very undesirable, frustrating for font makers who want consistent viewing, and it needs to be changed.
Simply because you CAN get 256 shades does not mean it is appropriate, nor is it desirable.
(It really is one of the big reasons why fonts often look bad on linux systems. The patented status of the delta hint was only part of the problem, The rasterizer itself was a major problem as well. Hacking out the "feature" makes demonstrably cleaner looking fonts.)
While I applaud anything this complex being made open source, I'm wondering it it's a few years too late.
We are on the cusp of an era of high pixel density ("retina") displays. Will we still need to worry about more complex rendering of fonts (ie: hints for small sizes), or just render at whatever point size to screen and be happy that the resolution is high enough to make whatever we display readable?
Help! I'm a slashdot refugee.
50% grey is a pixel value near 192, not one near 128. A pixel walue near 128 is much darker.
As far as I know, the engine doesn't handle this. It may even have some sort of hack to crudely compensate for the error, such as rendering things a bit more or less bold. Any such hack is unlikely to work with both white-on-black and black-on-white.
I think the problem is even implicit in the API. You can't just render to bitmap, cache the bitmaps, then generate pixels with any color.
Green on magenta tends to show the problem well. The edges shouldn't be dark. Giving equal brightness to each color, converting to greyscale should make the text fully dissapear. (identical pixel values)
Is this yet again more buggy crap from Adobe, the company that specializes in the dissemination and propagation of computer virii through their shoddy code?
Until recently, almost all desktop monitors were 86 DPI/PPI. Any oddballs were professional graphic designer displays or a few extremely expensive laptops and of course the UNIX X displays on SGI, HP and SUN systems. Now we have retina displays, tablets, multiple-display setups and what not. Most operating systems now have some form of support for PPI independent rendering in place, but almost no applications support this yet. Try putting your laptop display next to an external display and getting the windows and fonts to be the same physical size and moving them from one screen to the other to see what I'm talking about. Embedding 8pt and 12pt fonts at 86DPI made a lot of sense when this standard was being devised. It wasn't until portable displays started becoming popular that 86DPI wasn't the standard anymore.
I was promised a flying car. Where is my flying car?
Having written a font hinting system (from 2 decades ago), I can say from experience that hints are pointless in this day and age. The screen resolution of Android devices and smartphones renders them pointless, and the anti-aliasing makes for the best tiny fonts anyway.
Hints always introduced annoying problems like width differences which made it difficult to match screen and printer.
Sure on a 90dpi PC less than 12pt is fuzzy due to the anti-aliasing, but then again, that just shows you how far PCs have fallen behind that they're still 90dpi.
I keep seeing references to 'cff files'. Does this mean that this engine requires fonts to be in a new file format? Will we need someone to create all new fonts using this format?
There is no common OS (Linux, MacOS, Windows, etc.) that will make a pixel value of approximately 127,127,127 or 128,128,128 appear as 50% grey.
Therefore, nearly all image manipulation software needs to be gamma-aware. This includes any font rendering which involves anti-aliasing or transparancy or bitmap scaling or other blending. Nearly all software fails, resulting in normally-subtle artifacts. We live with the error, but it sucks. On rare occasions, the error can be severe.
Is hinting much of a problem with retina and similar high resolution displays?
No, but cost is. Hinting lets a device designer choose a less expensive screen while retaining legibility.