Part VIII · Variations
31. Design space
A variable font is one set of outlines together with instructions for changing them. Where a static font has one weight, a variable font has a weight axis, and any position along it, not only the weights the designer drew, is a font. With two axes, weight and width say, every point in a rectangle is a font. That rectangle, or box, or higher-dimensional block, is the font’s design space.
Every other chapter in this part is about what happens at a position in the design space: how deltas are found and added to advances, metrics, and outlines. This one is about the position itself: how the numbers an application asks for, like wght=700, become the coordinates that the rest of HarfBuzz reads. That takes three tables and three number formats, and it’s where HarfBuzz departs from the specification more often than almost anywhere else in its variation code.
The examples use a small family of test fonts, built for this part of the book in fonts/variations/ by tools/build-var-test-fonts.py. Like a real variable font, they’re made from static masters combined by fontTools’ varLib. They have a weight axis and a width axis, and three glyphs whose shapes make their coordinates easy to read: I is one stem, as wide as the weight says; H has two stems and a bar, and gets narrower along the width axis; V is a stem whose right edge leans as the weight grows.
[I=0+200|H=1+560|V=2+200][I=0+205|H=1+563|V=2+205][I=0+210|H=1+567|V=2+210][I=0+215|H=1+570|V=2+215][I=0+220|H=1+573|V=2+220][I=0+225|H=1+577|V=2+225][I=0+230|H=1+580|V=2+230][I=0+235|H=1+583|V=2+235][I=0+240|H=1+587|V=2+240][I=0+245|H=1+590|V=2+245][I=0+250|H=1+593|V=2+250][I=0+255|H=1+597|V=2+255][I=0+260|H=1+600|V=2+260][I=0+270|H=1+606|V=2+276][I=0+280|H=1+612|V=2+292][I=0+290|H=1+618|V=2+308][I=0+300|H=1+624|V=2+324][I=0+310|H=1+630|V=2+340][I=0+320|H=1+636|V=2+356][I=0+330|H=1+642|V=2+372][I=0+340|H=1+648|V=2+388][I=0+350|H=1+654|V=2+404][I=0+360|H=1+660|V=2+420][I=0+365|H=1+664|V=2+434][I=0+370|H=1+668|V=2+448][I=0+375|H=1+672|V=2+462][I=0+380|H=1+676|V=2+476][I=0+385|H=1+680|V=2+490][I=0+390|H=1+684|V=2+504][I=0+395|H=1+688|V=2+518][I=0+400|H=1+692|V=2+532][I=0+405|H=1+696|V=2+546][I=0+410|H=1+700|V=2+560]hb-vector variations/var.ttf "IHV" --variations=wght=…, drawn at every 25 from 100 to 900Under each drawing is what hb-shape says about the same text at the same position: glyph names, clusters, and advances. The advances are the easiest place to watch a position take effect. I’s advance is its stem plus 160 units of side bearing.
Axes: fvar
The axes are listed in the fvar table. Each has a tag, a minimum, a default, and a maximum, in user coordinates: the numbers people use, like 400 for a regular weight, or 75 for a width that is 75% of normal.
<fvar>
<!-- Weight -->
<Axis>
<AxisTag>wght</AxisTag>
<Flags>0x0</Flags>
<MinValue>100.0</MinValue>
<DefaultValue>400.0</DefaultValue>
<MaxValue>900.0</MaxValue>
<AxisNameID>256</AxisNameID>
</Axis>
<!-- Width -->
<Axis>
<AxisTag>wdth</AxisTag>
<Flags>0x0</Flags>
<MinValue>75.0</MinValue>
<DefaultValue>100.0</DefaultValue>
<MaxValue>100.0</MaxValue>
<AxisNameID>257</AxisNameID>
</Axis>
<!-- Light -->
<NamedInstance flags="0x0" subfamilyNameID="258">
<coord axis="wght" value="100.0"/>
<coord axis="wdth" value="100.0"/>
</NamedInstance>
<!-- Regular -->
<NamedInstance flags="0x0" subfamilyNameID="2">
<coord axis="wght" value="400.0"/>
<coord axis="wdth" value="100.0"/>
</NamedInstance>
<!-- Bold -->
<NamedInstance flags="0x0" subfamilyNameID="259">
<coord axis="wght" value="700.0"/>
<coord axis="wdth" value="100.0"/>
</NamedInstance>
<!-- Narrow -->
<NamedInstance flags="0x0" subfamilyNameID="260">
<coord axis="wght" value="400.0"/>
<coord axis="wdth" value="75.0"/>
</NamedInstance>
</fvar>| Font | Options | hb-info output |
|---|---|---|
| variations/var.ttf | --list-variations | |
(“Varitation” is a typo in hb-info, at util/hb-info.cc:1173.) The table also lists named instances, positions the designer has given names to. They come later in this chapter.
An axis has a flag, too. AXIS_FLAG_HIDDEN (hb-ot-var-fvar-table.hh:159) says that an application shouldn’t show the axis to users. HarfBuzz reports the flag and otherwise ignores it: a hidden axis can be set like any other.
From user coordinates to normalized ones
User coordinates are convenient for people and awkward for arithmetic, since every axis has its own range. So before any deltas are applied, each coordinate is normalized: mapped to −1 at the axis minimum, 0 at the default, and +1 at the maximum, in a straight line on each side of the default. Weight 100 becomes −1, 400 becomes 0, 650 becomes 0.5, and 900 becomes 1. Everything else in a variable font, every region and every delta, is written in terms of normalized coordinates.
The whole conversion is one short function, hb_ot_var_normalize_coords (hb-ot-var.cc:323):
for (unsigned int i = 0; i < coords_length; i++)
normalized_coords[i] = roundf (fvar.normalize_axis_value (i, design_coords[i]) * 65536.0f);
face->table.avar->map_coords_16_16 (normalized_coords, coords_length);
// Round to 2.14
for (unsigned i = 0; i < coords_length; i++)
normalized_coords[i] = (normalized_coords[i] + 2) >> 2;
There are three steps: normalize each axis with fvar; let the avar table bend the result; round. And three number formats along the way:
- The user’s value is a
float, and so is fvar’s arithmetic.normalize_axis_value(hb-ot-var-fvar-table.hh:185) clamps the value to the axis range and divides by the distance from the default to the minimum or the maximum. - The result is stored in 16.16 fixed point, a 32-bit integer with 16 bits after the binary point, and avar works in that.
- The final coordinates are 2.14, a 16-bit integer with 14 bits after the point, the format every variation table uses. Normalized coordinate 0.5 is stored as 8192, and 1 as 16384.
(v + 2) >> 2drops two bits, rounding halves upwards.
The specification describes the same steps, but asks for the normalization itself to be done in 16.16 arithmetic from a 16.16 input. HarfBuzz divides in floating point and rounds the result. The two can differ by one unit of 16.16, which only rarely survives the final rounding to 2.14.
Clamping means a value outside the axis has no further effect. A weight of 2000 is a weight of 900:
| Font | Text | Options | hb-shape output |
|---|---|---|---|
| variations/var.ttf | IHVU+0049 U+0048 U+0056 | --variations=wght=900 | [I=0+410| |
| variations/var.ttf | IHVU+0049 U+0048 U+0056 | --variations=wght=2000 | [I=0+410| |
There is one more quiet repair. The specification assumes that an axis’s minimum is no greater than its default, and its default no greater than its maximum, but doesn’t say what to do if they aren’t. HarfBuzz fixes them up when it reads them, in get_coordinates (hb-ot-var-fvar-table.hh:208): a minimum above the default is treated as the default, and so is a maximum below it. The comment says it’s to “simplify client math”. The repaired values are also what hb_ot_var_get_axis_infos reports, so an application never sees the font’s real minimum and maximum if they’re out of order.
Bending an axis: avar
A straight line from the default to each end is rarely what a designer wants. On a weight axis, the step from 400 to 500 might need to be smaller than the step from 800 to 900, or the designer may want the user’s 600 to be the design they drew at 750. The avar table bends each axis. For each axis it gives a segment map: pairs of normalized coordinates, from and to, with straight lines between them.
The test font var-avar.ttf is var.ttf with one segment map added, built from a designspace that says user weight 600 is design weight 750:
<avar>
<version major="1" minor="0"/>
<segment axis="wght">
<mapping from="-1.0" to="-1.0"/>
<mapping from="0.0" to="0.0"/>
<mapping from="0.4" to="0.7"/>
<mapping from="1.0" to="1.0"/>
</segment>
<segment axis="wdth">
<mapping from="-1.0" to="-1.0"/>
<mapping from="0.0" to="0.0"/>
<mapping from="1.0" to="1.0"/>
</segment>
</avar>In normalized coordinates that’s 0.4 to 0.7: halfway between 0 and 0.4 becomes halfway between 0 and 0.7, and so on. The two fonts agree at the default and at the ends, and disagree in between:
| Font | Text | Options | hb-shape output |
|---|---|---|---|
| variations/var.ttf | IU+0049 | --variations=wght=600 | [I=0+340] |
| variations/var-avar.ttf | IU+0049 | --variations=wght=600 | [I=0+380] |
| variations/var.ttf | IU+0049 | --variations=wght=750 | [I=0+380] |
| variations/var.ttf | IU+0049 | --variations=wght=900 | [I=0+410] |
| variations/var-avar.ttf | IU+0049 | --variations=wght=900 | [I=0+410] |
At 600, var-avar.ttf gives the stem that var.ttf gives at 750. Drag the slider here and compare it with the one at the top of the chapter:Compare the frames at 600 here with those at the top of the chapter: this axis gets heavy sooner.
[I=0+200|H=1+560|V=2+200][I=0+205|H=1+563|V=2+205][I=0+210|H=1+567|V=2+210][I=0+215|H=1+570|V=2+215][I=0+220|H=1+573|V=2+220][I=0+225|H=1+577|V=2+225][I=0+230|H=1+580|V=2+230][I=0+235|H=1+583|V=2+235][I=0+240|H=1+587|V=2+240][I=0+245|H=1+590|V=2+245][I=0+250|H=1+593|V=2+250][I=0+255|H=1+597|V=2+255][I=0+260|H=1+600|V=2+260][I=0+278|H=1+611|V=2+288][I=0+295|H=1+621|V=2+316][I=0+313|H=1+632|V=2+344][I=0+330|H=1+642|V=2+372][I=0+348|H=1+653|V=2+400][I=0+362|H=1+662|V=2+427][I=0+371|H=1+669|V=2+451][I=0+380|H=1+676|V=2+476][I=0+383|H=1+678|V=2+483][I=0+385|H=1+680|V=2+490][I=0+388|H=1+682|V=2+497][I=0+390|H=1+684|V=2+504][I=0+393|H=1+686|V=2+511][I=0+395|H=1+688|V=2+518][I=0+398|H=1+690|V=2+525][I=0+400|H=1+692|V=2+532][I=0+402|H=1+694|V=2+539][I=0+405|H=1+696|V=2+546][I=0+408|H=1+698|V=2+553][I=0+410|H=1+700|V=2+560]hb-vector variations/var-avar.ttf "IHV" --variations=wght=…, drawn at every 25 from 100 to 900A more forgiving avar than the specification’s
The specification is strict about segment maps. Each must map −1 to −1, 0 to 0, and +1 to +1, and a map that doesn’t is to be ignored: “no modification” for that axis. Its from-coordinates must increase. And the result is clamped to the range −1 to +1.
HarfBuzz does something else, and says so. The comment in SegmentMaps::map_float (hb-ot-var-avar-table.hh:196) reads: “CoreText is wild... PingFangUI avar needs all this special-casing... So we implement an extended version of the spec here, which is more robust and more likely to be compatible with the wild.” What it implements:
- A map with no pairs leaves the axis alone. A map with one pair shifts the whole axis by that pair’s difference.
- If the first pair is −1→−1 and the next pair also starts at −1, the first is skipped. That’s the PingFang case: a font that maps −1 to −1 and then −1 to −0.5 means that −1 goes to −0.5. The same goes for +1 at the other end.
- If several pairs share a from-coordinate, one of them is chosen: the middle of three, the last of a run below 0, the first above 0. At 0 itself, the one whose result is nearer 0, and on a tie the later one. (The comment there says “So we’ll just return the smallest one. lol”, and it is followed by four lines that can never run: the function has already returned.)
- A value before the first pair or after the last is shifted by that pair’s difference, not clamped.
- Otherwise, HarfBuzz interpolates between the two pairs on either side, whether or not the map follows the rules.
Nothing on this path clamps. With a malformed map, a coordinate can end up beyond ±1, and even the default can be mapped away from 0. In other words, a broken avar is used rather than ignored, and it is used the way Core Text uses it, so that a font looks the same in HarfBuzz as on Apple’s systems. That’s a choice of compatibility over the letter of the specification, and it’s typical of HarfBuzz.
avar version 2
Version 1 bends each axis on its own. Version 2 lets an axis’s final position depend on all the others. A width axis can make narrow designs lighter, so that stems don’t clog as letters get narrower; an optical size axis can drive weight and contrast together; and a font can have “parametric” axes, hidden from users, that the visible axes move in combination.
After its segment maps, a version 2 table has two more things: an item variation store, the same structure that holds advance and metric deltas (the subject of the next chapter), and an index map that says which entry in the store belongs to each axis. The store’s regions are written in normalized coordinates, so the deltas it gives can depend on any axis.
var-avar2.ttf maps every weight lighter at the narrowest width, in a designspace “mapping” from (wght 400, wdth 75) to (wght 300, wdth 75), and the same for the other weights:
<avar>
<version major="2" minor="0"/>
<segment axis="wght">
<mapping from="-1.0" to="-1.0"/>
<mapping from="0.0" to="0.0"/>
<mapping from="1.0" to="1.0"/>
</segment>
<segment axis="wdth">
<mapping from="-1.0" to="-1.0"/>
<mapping from="0.0" to="0.0"/>
<mapping from="1.0" to="1.0"/>
</segment>
<VarIdxMap Format="0">
<!-- Omitted values default to 0xFFFF/0xFFFF (no variations) -->
<Map index="0" outer="0" inner="0"/>
<Map index="1"/>
</VarIdxMap>
<VarStore Format="1">
<Format value="1"/>
<VarRegionList>
<!-- RegionAxisCount=2 -->
<!-- RegionCount=3 -->
<Region index="0">
<VarRegionAxis index="0">
<StartCoord value="0.0"/>
<PeakCoord value="0.0"/>
<EndCoord value="0.0"/>
</VarRegionAxis>
<VarRegionAxis index="1">
<StartCoord value="-1.0"/>
<PeakCoord value="-1.0"/>
<EndCoord value="0.0"/>
</VarRegionAxis>
</Region>
<Region index="1">
<VarRegionAxis index="0">
<StartCoord value="-1.0"/>
<PeakCoord value="-1.0"/>
<EndCoord value="0.0"/>
</VarRegionAxis>
<VarRegionAxis index="1">
<StartCoord value="-1.0"/>
<PeakCoord value="-1.0"/>
<EndCoord value="0.0"/>
</VarRegionAxis>
</Region>
<Region index="2">
<VarRegionAxis index="0">
<StartCoord value="0.0"/>
<PeakCoord value="1.0"/>
<EndCoord value="1.0"/>
</VarRegionAxis>
<VarRegionAxis index="1">
<StartCoord value="-1.0"/>
<PeakCoord value="-1.0"/>
<EndCoord value="0.0"/>
</VarRegionAxis>
</Region>
</VarRegionList>
<!-- VarDataCount=1 -->
<VarData index="0">
<!-- ItemCount=1 -->
<NumShorts value="3"/>
<!-- VarRegionCount=3 -->
<VarRegionIndex index="0" value="0"/>
<VarRegionIndex index="1" value="1"/>
<VarRegionIndex index="2" value="2"/>
<Item index="0" value="[-5461, 5461, 546]"/>
</VarData>
</VarStore>
</avar>| Font | Text | Options | hb-shape output |
|---|---|---|---|
| variations/var.ttf | IHVU+0049 U+0048 U+0056 | --variations=wdth=75 | [I=0+250| |
| variations/var-avar2.ttf | IHVU+0049 U+0048 U+0056 | --variations=wdth=75 | [I=0+230| |
| variations/var.ttf | IHVU+0049 U+0048 U+0056 | --variations=wght=900,wdth=75 | [I=0+400| |
| variations/var-avar2.ttf | IHVU+0049 U+0048 U+0056 | --variations=wght=900,wdth=75 | [I=0+370| |
Nothing has changed except the width, but I, whose stem only follows the weight, is thinner. Here the slider moves the width:Here the width changes, from 75 to 100:
[I=0+370|H=1+526|V=2+466][I=0+378|H=1+561|V=2+485][I=0+386|H=1+596|V=2+504][I=0+394|H=1+630|V=2+522][I=0+402|H=1+665|V=2+541][I=0+410|H=1+700|V=2+560]hb-vector variations/var-avar2.ttf "IHV" --variations=wght=900,wdth=…, drawn at every 5 from 75 to 100The order of operations is in the second half of map_coords_16_16 (hb-ot-var-avar-table.hh:665):
hb_vector_t<int> coords_2_14;
coords_2_14.resize (coords_length);
for (unsigned i = 0; i < coords_length; i++)
coords_2_14[i] = roundf (coords[i] / 4.f); // 16.16 -> 2.14
hb_vector_t<int> out;
out.alloc (coords_length);
for (unsigned i = 0; i < coords_length; i++)
{
int v = coords[i];
uint32_t varidx = varidx_map.map (i);
float delta = var_store.get_delta (varidx, coords_2_14.arrayZ, coords_2_14.length, var_store_cache);
float d = hb_clamp (delta * 4, -(float) (1<<17), +(float) (1<<17)); // 2.14 -> 16.16
v += (int) roundf (d);
v = hb_clamp (v, -(1<<16), +(1<<16));
out.push (v);
}
First every axis goes through its version 1 segment map. Then the store is evaluated once, at those results rounded to 2.14, and each axis’s delta is added to its unrounded 16.16 value. Only the sum is clamped, to ±1, “matching fontTools”, as the comment above the clamp says. The results go into a separate array, so no axis sees another’s version 2 result: there is one pass, not an iteration until things settle.
For years the only description of avar 2 was a proposal, and HarfBuzz’s comment still points to it: /* "Spec": https://github.com/be-fonts/boring-expansion-spec/issues/14 */ (hb-ot-var-avar-table.hh:61). Microsoft’s OpenType 1.9.1 still has only version 1. The 2026 edition of the ISO standard, ISO/IEC 14496-22, describes version 2 in clause 7.3.1, and HarfBuzz differs from it in three small ways:
- The standard adds each delta to the version 1 result already rounded to 2.14. HarfBuzz adds it to the 16.16 value and rounds once, at the end. The two can differ by one unit of 2.14.
- The standard clamps only when there is a variation store. HarfBuzz’s version 2 path always clamps, store or not.
- The standard requires avar to have as many segment maps as fvar has axes. HarfBuzz doesn’t check, for either version: it maps as many axes as both tables have.
There is also a second implementation in the same file, map_coords_2_14 (hb-ot-var-avar-table.hh:745), which rounds to 2.14 before adding the deltas, and has a comment to deprecate it “once fonttools is updated to use 16.16 normalization”. Only the subsetter uses it, when instancing. So the subsetter and the shaper can put the same user position one 2.14 unit apart.
Named instances
A named instance is a position in the design space with a name, like “Bold”, for menus. fvar stores a name ID and a full set of user coordinates for each, and, if its records are long enough, a PostScript name ID (get_instance_postscript_name_id, hb-ot-var-fvar-table.hh). The test font has four: Light, Regular, Bold, and Narrow.
| Font | Text | Options | hb-shape output |
|---|---|---|---|
| variations/var.ttf | IHVU+0049 U+0048 U+0056 | --named-instance=2 | [I=0+370| |
| variations/var.ttf | IHVU+0049 U+0048 U+0056 | --variations=wght=700 | [I=0+370| |
Choosing an instance doesn’t only set a position. HarfBuzz remembers the choice, and later settings are made on top of it. Here is hb_font_set_variations (hb-font.cc:3097), which is what --variations calls:
/* Initialize design coords. */
for (unsigned int i = 0; i < coords_length; i++)
design_coords[i] = axes[i].get_default ();
if (font->instance_index != HB_FONT_NO_VAR_NAMED_INSTANCE)
{
unsigned count = coords_length;
/* This may fail if index is out-of-range;
* That's why we initialize design_coords from fvar above
* unconditionally. */
hb_ot_var_named_instance_get_design_coords (font->face, font->instance_index,
&count, design_coords);
}
for (unsigned int i = 0; i < variations_length; i++)
{
const auto tag = variations[i].tag;
const auto v = variations[i].value;
for (unsigned axis_index = 0; axis_index < coords_length; axis_index++)
if (axes[axis_index].axisTag == tag)
design_coords[axis_index] = v;
}
Axes start at their defaults, then take the named instance’s values if one has been chosen, then the values asked for. So asking the Bold instance for a narrower width keeps its weight:
| Font | Text | Options | hb-shape output |
|---|---|---|---|
| variations/var.ttf | IHVU+0049 U+0048 U+0056 | --named-instance=2 --variations=wdth=75 | [I=0+360| |
| variations/var.ttf | IHVU+0049 U+0048 U+0056 | --variations=wght=700,wdth=75 | [I=0+360| |
| variations/var.ttf | IHVU+0049 U+0048 U+0056 | --variations=wdth=75 | [I=0+250| |
That’s useful, but the documentation above the function says something else: “Axes not included in @variations will be effectively set to their default values.” That’s only true when no instance has been chosen. Two more details of the same kind:
hb_font_set_var_named_instance(hb-font.cc:3269) returns at once if the index is the one already chosen, even if the coordinates have been changed since. Choosing Bold, then setting some other weight, then choosing Bold again leaves the other weight in place.- The loop above sets every axis with a matching tag. The ISO standard now allows a font to have several axes with one tag, to be moved together, and this is what it asks for. But
hb_ot_var_normalize_variations(hb-ot-var.cc:274), the face-level version, sets only the first.
The 2026 ISO standard also gives instances a flag, REPRESENTATIVE_INSTANCE, meaning that this instance’s values should stand in for the defaults of axes the user hasn’t set. HarfBuzz doesn’t read it. Its struct still describes the field as “Reserved for future use — set to 0” (hb-ot-var-fvar-table.hh:142).
Five ways to set a position
The public API has five functions for choosing a position, and they don’t all go through the steps above:
| Function | Starts from | fvar and avar | Notes |
|---|---|---|---|
hb_font_set_variations |
defaults, then the chosen named instance | yes | the usual way; --variations in the tools |
hb_font_set_variation |
the font’s current design coordinates | yes | changes one axis |
hb_font_set_var_coords_design |
defaults | yes | a full array of user coordinates; ignores the named instance |
hb_font_set_var_named_instance |
defaults | yes | then calls hb_font_set_variations with nothing |
hb_font_set_var_coords_normalized |
zeros | no | final 2.14 values, used as given |
The last one is for callers that have done the normalization themselves. It applies no avar, so a version 2 font loses its cross-axis effects, and no clamping, so out-of-range values pass straight through. It doesn’t know what user coordinates those values came from, so it sets the font’s design coordinates to NaN, “not a number”, as the documentation of hb_font_get_var_coords_design admits. That has a consequence the documentation doesn’t mention: a later hb_font_set_variation starts from those NaN values, and clamping NaN to an axis gives its minimum, since hb_max compares with >=. So setting one axis after setting normalized coordinates sends every other axis to its minimum.
What the rest of HarfBuzz sees
All five functions end in _hb_font_adopt_var_coords (hb-font.cc:2191):
font->coords = coords;
font->design_coords = design_coords;
font->num_coords = coords_length;
font->has_nonzero_coords = hb_any (hb_array (coords, coords_length));
font->changed ();
font->serial_coords = font->serial;
The normalized 2.14 coordinates are the only thing the variation code reads: gvar for outlines, HVAR and VVAR for advances, MVAR for metrics, GDEF and GPOS device tables, CFF2 blends, COLRv1 paints, VARC, and FeatureVariations, which chooses different GSUB and GPOS lookups at different positions. The design coordinates are kept only to be handed back to the caller, and to FreeType when the FreeType font functions are in use.
has_nonzero_coords is HarfBuzz’s test for “the default instance”, and it saves work everywhere. A font at its default, whether or not any variations were set, takes the same paths as a static font: advances straight from hmtx, no deltas computed. It is also why shape plans don’t multiply. hb_shape_full passes the coordinates to the shape-plan cache only when they aren’t all zero (hb-shape.cc:144), and even then the cache’s key doesn’t hold them: it holds which FeatureVariations records they select, so every position that selects the same records shares a plan (Shape plans and their cache). (A broken avar that maps the default away from 0 turns all of this off, as well as moving the default.)
Last, the two serial numbers. Every change to a font bumps serial, and a change of position also sets serial_coords. HarfBuzz’s own font functions keep caches of advances and outlines, and they check serial_coords to know when to throw them away (hb-ot-font.cc:290). A change of size alone keeps the advance cache, because the cached advances are in font units, before scaling.
Where to read the source
| File | What’s there |
|---|---|
src/hb-font.cc |
the five setters, from 3099; _hb_font_adopt_var_coords, 2166 |
src/hb-ot-var.cc |
hb_ot_var_normalize_coords, 323, and the face-level API |
src/hb-ot-var-fvar-table.hh |
axes, instances, normalize_axis_value, get_coordinates |
src/hb-ot-var-avar-table.hh |
segment maps and map_float, 196; version 2 in map_coords_16_16, 665; the instancer’s map_coords_2_14, 745 |
In short
- User coordinates are normalized per axis to −1, 0, and +1, bent by avar, and rounded to 2.14. Normalization is done in floating point, avar in 16.16.
- HarfBuzz clamps to the axis range, repairs axes whose minimum or maximum is on the wrong side of the default, and uses malformed avar maps the way Core Text does, without clamping.
- avar version 2 adds deltas from an item variation store, evaluated once at the version 1 results, so any axis can depend on all of them. It’s in the 2026 ISO standard, not in Microsoft’s OpenType 1.9.1.
- A chosen named instance becomes the base for later settings, whatever the documentation says.
- Setting normalized coordinates directly skips avar and clamping.