[ot-font] Only use vmtx side-bearing if table exists
Part of fixing https://github.com/harfbuzz/harfbuzz/issues/537
This commit is contained in:
parent
f41945e313
commit
6d0e67dee0
|
@ -382,6 +382,7 @@ hb_ft_get_glyph_v_advance (hb_font_t *font,
|
|||
|
||||
/* Note: FreeType's vertical metrics grows downward while other FreeType coordinates
|
||||
* have a Y growing upward. Hence the extra negation. */
|
||||
|
||||
return (-v + (1<<9)) >> 10;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -161,7 +161,8 @@ hb_ot_get_glyph_v_origin (hb_font_t *font,
|
|||
}
|
||||
|
||||
hb_glyph_extents_t extents = {0};
|
||||
if (ot_face->glyf->get_extents (font, glyph, &extents))
|
||||
if (ot_face->vmtx->has_data () &&
|
||||
ot_face->glyf->get_extents (font, glyph, &extents))
|
||||
{
|
||||
const OT::vmtx_accelerator_t &vmtx = *ot_face->vmtx;
|
||||
hb_position_t tsb = vmtx.get_side_bearing (font, glyph);
|
||||
|
|
|
@ -220,6 +220,8 @@ struct hmtxvmtx
|
|||
var_table.destroy ();
|
||||
}
|
||||
|
||||
bool has_data () const { return (bool) num_bearings; }
|
||||
|
||||
int get_side_bearing (hb_codepoint_t glyph) const
|
||||
{
|
||||
if (glyph < num_long_metrics)
|
||||
|
|
Loading…
Reference in New Issue