Skip to content
Commit e2926353 authored by Nikolaus Waxweiler's avatar Nikolaus Waxweiler Committed by Bastien Nocera
Browse files

xsettings: Change font hinting to default to 'slight'

The current default of "medium" is problematic because "medium"
and "full" are coarse descriptions that mean different things to
different font formats. This leads to widely inconsistent font rendering
and mishandling of popular (TrueType) fonts.

First, there are 2 major ways to make fonts readable on low-DPI screens:
- X-and-Y-fitting, as done on Windows for a long time before ClearType
  and DirectWrite. Glyph outlines are shuffled about (read: distorted) to
  fit them to the pixel grid. The goal is maximum sharpness at the
  expense of outline fidelity and glyph spacing.
- Y-only-fitting: Done by ClearType, DirectWrite and Adobe's proprietary
  font rendering engine to exploit the RGB-subpixel-stripe configuration
  of modern LCDs. Outlines are only fitted to the Y-axis, so the
  rasterizer can use tricks ("subpixel rendering") on the X-axis to
  enhance contrast or perceived resolution. Since horizontal (X-axis)
  metrics are unchanged, glyph spacing stays as is.

The higher the resolution (as in DPI) of a screen, the less important
hinting/grid-fitting becomes.

With the fontconfig property "autohint" set to false:
- FreeType's TrueType (.ttf) engine will use the native hinting bytecode
  in the font.  Depending on how much effort went into hinting the font
  and whether it was optimized for ClearType, glyphs might be
  grid-fitted to X-and-Y-axis or Y-axis only.  ClearType is not yet
  fully handled by FreeType (2.6.1), so popular fonts from the Windows
  world will be more or less distorted. "Medium" seems to be a variant
  of "full".
- the OpenType/CFF engine uses a different approach to rendering for
  low-DPI screens. Font designers of Type 1/CFF fonts just specify
  metadata that tell the hinting engine how to fit glyphs to the Y-axis
  (no X-fitting!), so the details of grid-fitting are deferred to the
  smarts of the hinting engine. "Medium" is equivalent to "full" here.
- The Postscript/Type 1 engine is the predecessor to the CFF engine in
  spirit. Hinting works as with CFF. The Type 1 engine in FreeType is
  older than Adobe's contributed CFF engine and hinting results are of
  far lower quality. "Medium" is mostly "Full".
- "Slight" will always trigger the autohinter regardless of font format.
  Y-fitting only.

Since the computer world is comprised of more than one typeface and more
than one font format, users will see jarringly inconsistent and
distorted fonts with "medium" and "full" due to the differences in the
engines and inconsistent quality of many typefaces in the wild.  The
problem is nicely visible when you go medium or full and mix font
formats.  A default installation of Fedora will have Cantarell in
OpenType/CFF (.otf) format in the UI and DejaVu (.ttf) on the console.
Cantarell is Y-fitted (and slightly emboldened), DejaVu X-and-Y-fitted.
The difference is jarring.

With the fontconfig property "autohint" set to true, FreeType's
autohinter is triggered and native hinting disabled. "Slight" will fit
to the Y-axis only, "medium" and "full" fit to X-and-Y-axes with
differing strength and usually lower quality.

From my testing, anything other than the autohinter on "slight" and the
native CFF engine on "medium" or "full" will lead to inconsistent
rendering and distortion. I recommend "slight" because the autohinter
does a good and consistent job regardless of font format, the maintainer
is also adding support for more scripts. Ubuntu has been using it for
years.

The future will soon bring high-DPI screens for the
masses, and that's where Y-only-fitting as done by the slight autohinter
and the CFF engine shines. Glyphs are rendered *much* cleaner and
inter-glyph-spacing remains untouched. A lot of native hinting done on
TrueType fonts, especially the X-and-Y variant, was made with low-DPI
screens in mind and can look bad when applied on high-DPI screens.

https://bugzilla.gnome.org/show_bug.cgi?id=756204
parent 963cea9d
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment