In drawing a glyph with variations, the coordinates specified by the
user must be mapped from the space defined by the axes' minimum, default,
and maximum values into a normalized space of -1.0, 0 and 1.0. The Axis
Variation table (tag:
'avar') allows the font to modify
the mapping between axis values and these normalized values, which are represented
shortFrac values. The default mapping to normalized coordinates
can be represented by the following pseudo-code fragment:
if (userValue < axisDefault)
normalizedValue = (userValue - axisDefault) / (axisDefault - axisMin)
normalizedValue = (userValue - axisDefault) / (axisMax - axisDefault)
If there is an Axis Variation table, then the normalized value may then be remapped, allowing the font to specify non-linear changes in how the variations are applied.
The Axis Variation Header is shown in the following table:
|fixed32||version||Table version; set to 0x00010000.|
|int32||axisCount||The number of variation axes.|
|shortFracSegment||segment[axisCount]||The segment maps for each axis.|
shortFracSegment format is as follows:
|uint16||pairCount||The number of pairs for this axis.|
|shortFracCorrespondence||correspondence[pairCount]||The array of correspondence values.|
shortFracCorrespondence structure is shown in the following
|shortFrac||fromCoord||Value in normalized user space.|
|shortFrac||toCoord||Value in normalized axis space.|
shortFracSegment defines a mapping between the user's
fromCoord), and the coordinate along the variation
toCoord). The mapping is expressed as a series of correspondence
points, each pair of which specifies a range in the user's space and a corresponding
range in the axis' space. Using this, each value of the user's coordinate
is mapped to a corresponding value in the axis' space.
Let's look at an example of how this mapping works. The following table
shows a set of mapping data that might be present in the
table of a font.
The following table shows how specified user values would be mapped into
axis values, using this
A segment must always have at least three correspondence pairs: minus
one mapping to minus one, zero mapping to zero, and one mapping to one.
This implies that a segment may not change the sign of a coordinate value.
The segment's pairs must be sorted on
with -1.0 and ending with 1.0.
shortFrac is an
with a bias of 14. This means it can represent numbers between 1.999
(0x8000). 1.0 is stored as 16384
and -1.0 is stored as -16384
[Table of Contents]