[GPOS] Cache VarStore region scalars
This commit is contained in:
parent
5fbc70c59b
commit
f2a2fb91a3
|
@ -3010,7 +3010,9 @@ struct VariationStore
|
|||
|
||||
protected:
|
||||
HBUINT16 format;
|
||||
public:
|
||||
Offset32To<VarRegionList> regions;
|
||||
protected:
|
||||
Array16OfOffset32To<VarData> dataSets;
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY_SIZED (8, dataSets);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<float> 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 ()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue