diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 577cf634d..cdcffd424 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -3010,7 +3010,9 @@ struct VariationStore protected: HBUINT16 format; + public: Offset32To regions; + protected: Array16OfOffset32To dataSets; public: DEFINE_SIZE_ARRAY_SIZED (8, dataSets); diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 2f9186a2a..4d1872493 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -146,23 +146,24 @@ struct ValueFormat : HBUINT16 if (!use_x_device && !use_y_device) return ret; const VariationStore &store = c->var_store; + auto *cache = &c->regions_cache; /* pixel -> fractional pixel */ if (format & xPlaDevice) { - if (use_x_device) glyph_pos.x_offset += (base + get_device (values, &ret)).get_x_delta (font, store); + if (use_x_device) glyph_pos.x_offset += (base + get_device (values, &ret)).get_x_delta (font, store, cache); values++; } if (format & yPlaDevice) { - if (use_y_device) glyph_pos.y_offset += (base + get_device (values, &ret)).get_y_delta (font, store); + if (use_y_device) glyph_pos.y_offset += (base + get_device (values, &ret)).get_y_delta (font, store, cache); values++; } if (format & xAdvDevice) { - if (horizontal && use_x_device) glyph_pos.x_advance += (base + get_device (values, &ret)).get_x_delta (font, store); + if (horizontal && use_x_device) glyph_pos.x_advance += (base + get_device (values, &ret)).get_x_delta (font, store, cache); values++; } if (format & yAdvDevice) { /* y_advance values grow downward but font-space grows upward, hence negation */ - if (!horizontal && use_y_device) glyph_pos.y_advance -= (base + get_device (values, &ret)).get_y_delta (font, store); + if (!horizontal && use_y_device) glyph_pos.y_advance -= (base + get_device (values, &ret)).get_y_delta (font, store, cache); values++; } return ret; @@ -465,9 +466,9 @@ struct AnchorFormat3 *y = font->em_fscale_y (yCoordinate); if (font->x_ppem || font->num_coords) - *x += (this+xDeviceTable).get_x_delta (font, c->var_store); + *x += (this+xDeviceTable).get_x_delta (font, c->var_store, &c->regions_cache); if (font->y_ppem || font->num_coords) - *y += (this+yDeviceTable).get_y_delta (font, c->var_store); + *y += (this+yDeviceTable).get_y_delta (font, c->var_store, &c->regions_cache); } bool sanitize (hb_sanitize_context_t *c) const diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index c9750ff63..74922b3da 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -627,6 +627,7 @@ struct hb_ot_apply_context_t : recurse_func_t recurse_func; const GDEF &gdef; const VariationStore &var_store; + hb_vector_t regions_cache; hb_direction_t direction; hb_mask_t lookup_mask; @@ -669,7 +670,16 @@ struct hb_ot_apply_context_t : auto_zwj (true), per_syllable (false), random (false), - random_state (1) { init_iters (); } + random_state (1) + { + init_iters (); + if (table_index == 1 && font->num_coords) /* GPOS */ + { + regions_cache.resize ((&var_store+var_store.regions).regionCount); + for (auto &f : regions_cache.writer ()) + f = NAN; + } + } void init_iters () {