[var] Fix getting side-bearing variations
In HVAR/VVAR, if the side-bearing mappings are null, it means the table does not have them and they should be loaded from glyf table. Previous logic was returning zer0. Part of fixing https://github.com/harfbuzz/harfbuzz/issues/1694
This commit is contained in:
parent
78b4f39821
commit
71d52e10aa
|
@ -241,8 +241,9 @@ struct hmtxvmtx
|
||||||
if (unlikely (glyph >= num_bearings) || !font->num_coords)
|
if (unlikely (glyph >= num_bearings) || !font->num_coords)
|
||||||
return side_bearing;
|
return side_bearing;
|
||||||
|
|
||||||
if (var_table.get_length ())
|
float lsb;
|
||||||
return side_bearing + var_table->get_side_bearing_var (glyph, font->coords, font->num_coords);
|
if (var_table->get_side_bearing_var (glyph, font->coords, font->num_coords, &lsb))
|
||||||
|
return side_bearing + lsb;
|
||||||
|
|
||||||
return _glyf_get_side_bearing_var (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
|
return _glyf_get_side_bearing_var (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -329,16 +329,16 @@ struct HVARVVAR
|
||||||
store_cache);
|
store_cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
float get_side_bearing_var (hb_codepoint_t glyph,
|
bool get_side_bearing_var (hb_codepoint_t glyph,
|
||||||
const int *coords, unsigned int coord_count) const
|
const int *coords, unsigned int coord_count,
|
||||||
|
float *lsb) const
|
||||||
{
|
{
|
||||||
if (!has_side_bearing_deltas ()) return 0.f;
|
if (!lsbMap) return false;
|
||||||
uint32_t varidx = (this+lsbMap).map (glyph);
|
uint32_t varidx = (this+lsbMap).map (glyph);
|
||||||
return (this+varStore).get_delta (varidx, coords, coord_count);
|
*lsb = (this+varStore).get_delta (varidx, coords, coord_count);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_side_bearing_deltas () const { return lsbMap && rsbMap; }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FixedVersion<>version; /* Version of the metrics variation table
|
FixedVersion<>version; /* Version of the metrics variation table
|
||||||
* initially set to 0x00010000u */
|
* initially set to 0x00010000u */
|
||||||
|
|
Loading…
Reference in New Issue