1

Zooming in at any screenshot of black text on white background reveals a colorful image with bluish right fringes and reddish left fringes: Zoom In of the word "Open"

While I didn't expect the image to be binary black and white because of aliasing, I expected it to be grayscale, that is RGB=(x,x,x) for all pixels. What is the reason for this?

MrX
  • 141
  • 2
  • 6
  • how are you rendering? with what? to what? For example palette based rendering targets (like 256 color images using default VGA palette) can consider those colored shades closer to target colors ... how are you zooming? I saw similar stuff caused by image viewer when zoomed too much – Spektre Aug 10 '22 at 07:08
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Aug 10 '22 at 07:12
  • I found this phenomenon everywhere - Chrome, text editors, OS menus (on Ubuntu). I take a screenshot & zoom in using software similar to Photoshop which does not resample the image or alter colors. – MrX Aug 17 '22 at 06:47

1 Answers1

0

Different text platforms support various modes for how font "smoothing" is done when glyphs get rasterized. For example, in Windows GDI, when the CreateFont() function is called, the iQuality parameter can be used to set different font smoothing modes. In DirectWrite and Direct2D, the DWRITE_RENDERING_MODE enumeration or D2D1_TEXT_ANTIALIAS_MODE enumerations can be used to set different font smoothing modes. Other platforms will likely have similar alternative options.

Aliased (no smoothing) and grayscale are two modes that text platforms have offered for scalable vector fonts for 30+ years. Then in 1999, Microsoft introduced a new kind of font smoothing called ClearType. This is the kind of smoothing seen in your screenshot. Other platforms like macOS have since introduced similar capabilities. These take advantage of the individual R, G, and B elements that make up a pixel in LCD displays. When tuned correctly for a given user, studies have shown this type of font smoothing to provide better legibility.

An extra benefit of ClearType is that it allows glyph positions to be set at sub-pixel rather than whole pixel positions, effectively increasing the resolution that can be used for layout out text on a surface. In addition, ClearType rendering can be done with hardware acceleration to provide faster rendering—see ClearType Overview (WPF).

Peter Constable
  • 2,707
  • 10
  • 23
  • That's interesting! So to work properly the algorithm needs to know the physical positions of the subpixels (e.g., red on the left, green in the middle, blue on the right). The screenshot is taken from my Ubuntu (Linux). Together with Windows and macOS that you mentioned, it looks like every modern OS has this feature. – MrX Aug 17 '22 at 06:41
  • 1
    Most LCD screens have RGB (LtR) arrangement, but in the past some have been BGR. At the time, the metadata signals from the display (the "EDID") did not carry a description of the sub-pixel arrangement, so there was no way for the rendering algorithms to know---it required human setting, and text could look pretty bad if it defaulted to RGB but the display was BGR. Today, I don't think BGR is too common. More recently, displays have introduced other elements, like a white element, but IIUC that has had less impact. – Peter Constable Aug 17 '22 at 15:22