[ot-font] Vertically center glyph in vertical writing fallback
Fixes https://github.com/harfbuzz/harfbuzz/issues/537
This commit is contained in:
parent
bf03d7e962
commit
1449498e1d
|
@ -175,12 +175,21 @@ hb_ot_get_glyph_v_origin (hb_font_t *font,
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_glyph_extents_t extents = {0};
|
hb_glyph_extents_t extents = {0};
|
||||||
if (ot_face->vmtx->has_data () &&
|
if (ot_face->glyf->get_extents (font, glyph, &extents))
|
||||||
ot_face->glyf->get_extents (font, glyph, &extents))
|
|
||||||
{
|
{
|
||||||
const OT::vmtx_accelerator_t &vmtx = *ot_face->vmtx;
|
if (ot_face->vmtx->has_data ())
|
||||||
hb_position_t tsb = vmtx.get_side_bearing (font, glyph);
|
{
|
||||||
*y = extents.y_bearing + font->em_scale_y (tsb);
|
const OT::vmtx_accelerator_t &vmtx = *ot_face->vmtx;
|
||||||
|
hb_position_t tsb = vmtx.get_side_bearing (font, glyph);
|
||||||
|
*y = extents.y_bearing + font->em_scale_y (tsb);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
hb_font_extents_t font_extents;
|
||||||
|
font->get_h_extents_with_fallback (&font_extents);
|
||||||
|
hb_position_t advance = font_extents.ascender - font_extents.descender;
|
||||||
|
int diff = advance - -extents.height;
|
||||||
|
*y = extents.y_bearing + (diff >> 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue