Closed Bug 397423 Opened 17 years ago Closed 13 years ago

Enable Cleartype "natural widths" mode

Categories

(Core :: Graphics, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: roc, Unassigned)

Details

Attachments

(7 files)

http://msdn2.microsoft.com/en-us/library/aa480221.aspx By default Cleartype uses "compatible widths", which means they force glyphs to have to have the same advance widths when hinted as when not hinted. According to the above page, this can be disabled in Windows XP1 and later. We should disable it because we do not need that compatibility and using "natural widths" should produce better looking text.
Flags: blocking1.9?
I mean Windows XP, SP1.
Flags: blocking1.9? → blocking1.9-
Whiteboard: [wanted-1.9]
Flags: wanted1.9+
Whiteboard: [wanted-1.9]
I tried setting CLEARTYPE_NATURAL_QUALITY in the logFont structure that's created in FontEntry::FillLogFont (gfxWindowFonts.cpp) on Vista. The result was, umm, "interesting". I do indeed get different spacing than with the DEFAULT_QUALITY setting, but the result is most definitely not an improvement; the glyph spacing is quite poor. To me, it looks as though I'm getting exactly the same glyphs as with the DEFAULT setting, but spaced differently (usually tighter, but irregular), as if the flag has affected the metrics but has not altered the actual rasterization of the glyphs. Further investigation needed; there may be additional places where we need to set different flags to control the rendering properly. Maybe somewhere within Cairo....
Yes, Cairo handles this stuff internally in _win32_scaled_font_create. Doesn't look like it offers any API to access the "natural widths" setting at the moment, but I'll try hacking something in locally to see if the results are worthwhile. If so, we can propose a patch for Cairo to add the support we'll need.
Should we use the compatible mode if the font style is system font? UI by XUL should emulate the native UI rendering/behavior.
Attached screenshots providing a comparison between ClearType in "compatible" and "natural widths" modes, using the Calibri font on Vista. (I have also looked at a number of other fonts, and could post more images if desired.) The difference is often slight, though with some sizes/fonts it is more obvious. Doing this involves a patch to Cairo, to support an additional font quality setting on Windows. I will tidy up my patch and send it upstream to see if they'd like to adopt it.
Should be easy to add the option to upstream; though from looking at the screenshots, the compatible widths mode looks better to me in a lot of cases. The UI font issue in particular is going to be tricky, e.g. look at the "H" in History/Help and the T in Tools.
Yes, I agree; sometimes one looks better, sometimes the other. Which suggests to me that this should probably be controlled by a preference (unless we simply decide it's not worth doing it at all).
Added sample screenshots from wikipedia.org as well. In this case, I think that the "natural" mode gives better results for some things; for example, the M and N in the language lists look better to me, as does the spacing of the word "search". But the option doesn't improve everything, as already noted.
Sounds to me like this is not worth doing.
Yes, I'm inclined to agree. Attaching my current patch for safe-keeping in case we ever want to revisit this, but for now there doesn't seem to be a clear benefit. When I posted the first screenshots, I didn't want to prejudice other people's opinions by saying much about them right away, but overall I was pretty disappointed with the results.
Note: If we do ever come back to this, and want to use the natural-widths patch to Cairo, it's unfinished: it adds a new enumeration value for cairo_antialias_t, so this needs to be handled by the other font backends as well as the win32 one. (They'd just fall back to CAIRO_ANTIALIAS_SUBPIXEL if they don't have a separate mode for this.) Also should do the same in cairo_set_antialias(). This doesn't affect the current usage in Gecko, but would be needed for the patch to be appropriate for Cairo in general.
Marking WONTFIX based on comments 16 and 17.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: