Font fractional metrics hint key.
The
FRACTIONALMETRICS
hint controls whether the positioning
of individual character glyphs takes into account the sub-pixel
accuracy of the scaled character advances of the font or whether
such advance vectors are rounded to an integer number of whole
device pixels.
This hint only recommends how much accuracy should be used to
position the glyphs and does not specify or recommend whether or
not the actual rasterization or pixel bounds of the glyph should
be modified to match.
Rendering text to a low resolution device like a screen will
necessarily involve a number of rounding operations as the
high quality and very precise definition of the shape and
metrics of the character glyphs must be matched to discrete
device pixels.
Ideally the positioning of glyphs during text layout would be
calculated by scaling the design metrics in the font according
to the point size, but then the scaled advance width will not
necessarily be an integer number of pixels.
If the glyphs are positioned with sub-pixel accuracy according
to these scaled design metrics then the rasterization would
ideally need to be adjusted for each possible sub-pixel origin.
Unfortunately, scaling each glyph customized to its exact
subpixel origin during text layout would be prohibitively
expensive so a simplified system based on integer device
positions is typically used to lay out the text.
The rasterization of the glyph and the scaled advance width
are both adjusted together to yield text that looks good at
device resolution and has consistent integer pixel distances
between glyphs that help the glyphs look uniformly and
consistently spaced and readable.
This process of rounding advance widths for rasterized glyphs
to integer distances means that the character density and the
overall length of a string of text will be different from the
theoretical design measurements due to the accumulation of
a series of small differences in the adjusted widths of
each glyph.
The specific differences will be different for each glyph,
some being wider and some being narrower than their theoretical
design measurements.
Thus the overall difference in character density and length
will vary by a number of factors including the font, the
specific device resolution being targeted, and the glyphs
chosen to represent the string being rendered.
As a result, rendering the same string at multiple device
resolutions can yield widely varying metrics for whole strings.
When FRACTIONALMETRICS
are enabled, the true font design
metrics are scaled by the point size and used for layout with
sub-pixel accuracy.
The average density of glyphs and total length of a long
string of characters will therefore more closely match the
theoretical design of the font, but readability may be affected
since individual pairs of characters may not always appear to
be consistent distances apart depending on how the sub-pixel
accumulation of the glyph origins meshes with the device pixel
grid.
Enabling this hint may be desirable when text layout is being
performed that must be consistent across a wide variety of
output resolutions.
Specifically, this hint may be desirable in situations where
the layout of text is being previewed on a low resolution
device like a screen for output that will eventually be
rendered on a high resolution printer or typesetting device.
When disabled, the scaled design metrics are rounded or adjusted
to integer distances for layout.
The distances between any specific pair of glyphs will be more
uniform on the device, but the density and total length of long
strings may no longer match the theoretical intentions of the
font designer.
Disabling this hint will typically produce more readable results
on low resolution devices like computer monitors.
The allowable values for this key are