Rotating sub-pixel text rendering
John Gruber of Daring Fireball (thanks for the link!) knows a lot about font-rendering, however in a recent post discussing screen-rotation and sub-pixel text rendering he let this slip:
“I tested it on my Cinema Display with the screen rotated 90°, and, to my eyes, sub-pixel anti-aliasing still looked good.”
That is just preposterous. Aside from his observation being completely wrong, he also revealed a bug in OS X: The current system doesn’t recognize rotated pixel orientations, sub-pixel rendering on rotated screens should probably be disabled automatically. (rdar://problem/5627732)
Here are two screenshots of my browser’s address bar as displayed on my Cinema Display, which clearly shows the difference. The top image is Leopard’s default sub-pixel rendering. The second image is the same bar photographed with my display rotated 90°, the photo was then rotated back in Photoshop for better comparison.
The text was apparently calculated against the presumed horizontal LCD primary orientation. But because the pixels were rotated, several of the letterform stems (verticals) are drawing as full-pixel-width colored lines. The first “h” is especially glaring, its stem and stroke are drawn as a pair of dark red and light blue lines.
Sub-pixel rendering takes advantage of a known horizontal alignment of the three color primaries that make up each physical pixel. The algorithm seems to render text at 3x the horizontal resolution, ignoring the color information and treating each third-pixel as a valid light source to use for drawing letterforms. That 3x width is then striped with red, green and blue to match screen’s component primary ordering. (That was an educated guess)
As Steve Weller stated in the post John linked, the human eye has “pathetic color-resolution”. This fact is exploited all over the place in video, with many formats sampling color only once for every four luminance pixels.
Several things are at play here:
- Human vision is the bifocal product of horizontally arranged eyes.
- Most written human language uses letterforms which are vertically oriented and horizontally distinguished. Especially Latin-derived languages.
- Most human languages read horizontally.
- Human vision tends to be less color sensitive for motion, or when scanning information (like reading)
It all just kind of worked out perfectly. Digital color reproduction combined our horizontal predisposition with our soft and slow perception of color, and then arranged color primaries horizontally. Text also reads horizontally, and since the viewer is rapidly moving their eyes, we perceive shape and contrast before color. Additionally, Latinate languages evolved letterforms which utilize horizontal variations against a largely regular vertical syncopation. Presto: sub-pixel rendering just seems fantastically obvious.
Regarding John’s closing supposition,
“I’m not sure the iPhones rotating display is reason enough to rule out sub-pixel rendering.”
Based on everything leading up to sub-pixel rendering in the first place, most of the benefits would be lost if the underlying pixel grid was vertically oriented. The sensitivity of computer text falls across the horizontal axis. Adding resolution to the vertical axis isn’t worth the effort.
Sub-pixel rendering is ultimately a transitional technology anyway, a half-step that improves the now while waiting for a better and inevitable future to arrive. Once we start seeing iPhone level pixel-densities all over the place, sub-pixel rendering will began its transition to technology footnote.
Digital displays will someday reach a point where every physical pixel is capable of producing every color of visible light. (And someone will doubtlessly push into near infrared and ultra-violet, claiming increased realism and fidelity). Future displays will also be operating at a density where anti-aliasing may not be necessary at all.
I still think Apple’s decision to use standard anti-aliasing for the Leopard menu bar was a mistake. Unless they’ve got some spiffy high-pixel-density cinema displays ready for MacWorld and enable system-wide resolution independence in 10.5.x, switching to standard anti-aliased text rendering in the menu bar was a change that should have been postponed. The necessary hardware pool just isn’t here yet and the result is an interface that looks markedly worse than it did under previous releases.
Any idea what the sub-pixel orientation is on the iPhone’s screen?
“switching to standard anti-aliased text rendering in the menu bar was a change that should have been postponed”.
Or, it could just be a bug that was deemed not a show stopper. I would not blame them. Apple claims to have sold 2 million copies of Leopard in its first weekend. In dollars, that is around 250 million dollar of revenue. In interest, that would fetch say $10 million a year (at 4%), or about $25,000 a day. For that money, I would not postpone a release for a day to fix such a relatively minor bug.
This is something that can be changed in an update. As shown with the iPhone SDK, or lack there of, Apple is pushing products out early, often, and sometimes before they are fully realized as they envision.
It looks good no matter what on a 17″ 1920×1200 MacBook Pro display :) Once you use a high res display you never want to go back…
Speaking as one of the early researchers on anti-aliasing, I think you have this all wrong. Sub-pixel anti-aliasing is not just about taking advantage of sub-pixel color dots on a display. The human visual system is designed to trade brightness for resolution (this is also why half-toning works). Anti-aliasing will provide (at least some) benefits in any orientation.
For more information, see http://portal.acm.org/citation.cfm?id=807509&dl=GUIDE&dl=ACM
Even if it’s not very useful in rendering letters like I and l and U, logically subpixel rendering would still be pretty useful rendering e and E and F and – and = and anything else with horizontal lines.
I agree that, if Apple isn’t going to take the time to do vertical subpixel rendering, they should at least disable subpixel rendering on rotated screens where, as the screenshot shows, it looks horrible.
1. Got any evidence that our horizontally-arranged eyes have anything to do with this, or is that just pure conjecture?
2. Further, many letters are distinguished vertically, not horizontally. Take the lower -case b and p, for example. They only differ on the vertical axis.
3. What does reading our languages horizontally have to do with anything regarding anti-aliasing? We also read vertically – down the page (or up, depending on the language). I don’t know of any written language that is purely 1-dimensional. You reach the edge of the page eventually.
4. Yes, we have less color resolution. But how does that make a difference in horizontal versus vertical orientation? That is equally at play no matter which way the pixels have been oriented.
“Sub-pixel antialiasing algorithms require to know the background color over which the glyphs will be draw. Since Core Animation is a compositing engine, and allows layers to have an arbitrary opacity, and does the final composite on graphics hardware (if possible), Quartz cannot assume anything about the background color and thus disables sub-pixel antialiasing.
This is bang on the answer as to why things work as they do with respect to this.
Frank, iPhone pixels are oriented as Red-Green-Blue across the short axis. So if the iPhone was to do sub-pixel rendering, it would only really help when reading with the phone held vertically.
Wm, thank you for the comment. I’m not in a position to argue your knowledge, but I think we’re saying the same thing. The brightness of the horizontally arranged subpixels are used to increase the apparent resolution of onscreen letterforms.
Gruber posted an excellent link explaining the use of subpixels: http://alienryderflex.com/sub_pixel/
The sub-pixel orientation is the reason black-to-white edges go from blue to cyan to white on the left, while the opposite transition goes red to yellow to white. Sub-pixels are being added to fill in horizontal resolution. We don’t perceive it, as you said, because our eyes are more attuned to brightness (contrast) than color.
Harvard, I can’t cite any specific scientific study, but the horizontal bias of human vision shows itself everywhere.
Yes letterforms have distinguishing elements which break the vertical, but the point is that humans read faster when there is a steady horizontal rhythm to the verticals — like stripes. Type is kerned to improve that horizontal rhythm. Bad kerning makes things harder to read, this is yet another reason why sub-pixel text rendering across the horizontal benefits legibility. There is a long and rich history of western typographic evolution which brought us to horizontally syncopated letterforms.
The point here is the confluence of luck that made sub-pixel rendering work. It’s a hack, but it’s a hack that works because of how we see and how we read.
my question is… I’ve heard that the cinema display is not supposed to be rotated, but I’d love to try this. I understood that of had something to do with heat. could anyone give me an answer? thanks!
Well, it’s great to hear some noise being made about this, finally. I made a blog post reporting this bug in OS X back in February (I reported the bug to Apple through ADC, as well). I had hoped that it would be fixed in Leopard but, alas, it was not to be.
I, too, had taken close-up photos of “normal” and rotated screen font rendering with subpixeling active:
Thanks to this bug, I must let the opportunities of subpixeling pass me by on my main 30″ display in order to utilize a secondary, rotated display.
Sadly, it’s standard anti-aliasing for me.
It’s worth mentioning that I noticed on my old Compaq iPaq PocketPC that it (“it” being Windows CE or Windows Mobile or Windows On The Hoof or whatever they call it now) handled rotation just fine. Yes, the “effect” was more noticeable when the subpixeling was benefiting the horizontal, but it was certainly better than no subpixeling when it was in use on the vertical.
Not to be a post hog, but in reviewing my aforelinked blog post, I was reminded that I reported this to Apple in September ’06. They had a year to make it right!
Maybe they lost my report. :-)
For what it’s worth, it seems that Apple’s subpixel rendering routine only works on the horizontal sub-pixels right now and not vertical.
Here’s a datapoint from my Leopard machine and LCD monitor (Dell 1905FP):
Appearance font smoothing setting:
Automatic – best for main display
Landscape: standard antialiasing
Portrait: standard antialiasing
Medium -best for flat panel
– Landscape mode: sub-pixel antialiasing
– Portrait mode: standard antialiasing
It may require relaunching the app in the new orientation to see the effects.
You can test it for yourself. Try the different orientations. Launch TextEdit with sample text. Screenshot. Open in Preview. Zoom in. If you see red and blue color fringing, it’s using sub-pixel antialiasing. If not, it’s using standard.
I’d heard that Automatic would recognize LCDs automatically and use font smoothing when appropriate, but apparently it’s not doing so for me.
The upshot is that I lose sub-pixel antialiasing when in portrait mode, and that for me, it’s best to leave font smoothing at Medium. Also, I suspect that I need to relaunch my app for the appropriate antialiasing routines to kick in and that it’s possible to be sub-pixel rendering incorrectly when I switch to portrait mode without relaunching.