[COLR] Fix variation code

This commit is contained in:
Behdad Esfahbod 2022-12-12 10:11:02 -07:00
parent ff332b14ea
commit c64661b2f8
1 changed files with 10 additions and 6 deletions

View File

@ -930,6 +930,7 @@ struct ClipBox
}
bool get_extents (hb_glyph_extents_t *extents,
const DeltaSetIndexMap &varIdxMap,
const VariationStore &varStore,
hb_array_t<int> coords) const
{
@ -944,10 +945,10 @@ struct ClipBox
if (u.format == 2 && coords && u.format2.varIdxBase != HB_OT_LAYOUT_NO_VARIATIONS_INDEX)
{
uint32_t varIdx = u.format2.varIdxBase;
extents->x_bearing += _hb_roundf (varStore.get_delta (varIdx , coords));
extents->y_bearing += _hb_roundf (varStore.get_delta (varIdx+1, coords));
extents->width += _hb_roundf (varStore.get_delta (varIdx+2, coords));
extents->height += _hb_roundf (varStore.get_delta (varIdx+3, coords));
extents->x_bearing += _hb_roundf (varStore.get_delta (varIdxMap.map (varIdx+0), coords));
extents->y_bearing += _hb_roundf (varStore.get_delta (varIdxMap.map (varIdx+1), coords));
extents->width += _hb_roundf (varStore.get_delta (varIdxMap.map (varIdx+2), coords));
extents->height += _hb_roundf (varStore.get_delta (varIdxMap.map (varIdx+3), coords));
}
return true;
@ -986,10 +987,11 @@ struct ClipRecord
bool get_extents (hb_glyph_extents_t *extents,
const void *base,
const DeltaSetIndexMap &varIdxMap,
const VariationStore &varStore,
hb_array_t<int> coords) const
{
return (base+clipBox).get_extents (extents, varStore, coords);
return (base+clipBox).get_extents (extents, varIdxMap, varStore, coords);
}
public:
@ -1095,13 +1097,14 @@ struct ClipList
bool
get_extents (hb_codepoint_t gid,
hb_glyph_extents_t *extents,
const DeltaSetIndexMap &varIdxMap,
const VariationStore &varStore,
hb_array_t<int> coords) const
{
auto *rec = clips.as_array ().bsearch (gid);
if (rec)
{
rec->get_extents (extents, this, varStore, coords);
rec->get_extents (extents, this, varIdxMap, varStore, coords);
return true;
}
return false;
@ -1575,6 +1578,7 @@ struct COLR
return false;
if ((this+clipList).get_extents (glyph,
extents,
this+varIdxMap,
this+varStore,
hb_array (font->coords, font->num_coords)))
{