[glyf] Address Behdad's reviews

Addresses https://github.com/harfbuzz/harfbuzz/pull/1999#issuecomment-539298559
* Don't check against Null pool
* Remove cryptic _tt suffix
This commit is contained in:
Ebrahim Byagowi 2019-10-08 16:29:15 +03:30
parent 6961766db2
commit b068e25f8f
2 changed files with 10 additions and 10 deletions

View File

@ -313,13 +313,13 @@ hb_ot_font_set_funcs (hb_font_t *font)
#ifndef HB_NO_VAR #ifndef HB_NO_VAR
int int
hb_ot_get_side_bearing_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical) _glyf_get_side_bearing_var (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical)
{ {
return font->face->table.glyf->get_side_bearing_var (font, glyph, is_vertical); return font->face->table.glyf->get_side_bearing_var (font, glyph, is_vertical);
} }
unsigned unsigned
hb_ot_get_advance_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical) _glyf_get_advance_var (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical)
{ {
return font->face->table.glyf->get_advance_var (font, glyph, is_vertical); return font->face->table.glyf->get_advance_var (font, glyph, is_vertical);
} }

View File

@ -43,10 +43,10 @@
HB_INTERNAL int HB_INTERNAL int
hb_ot_get_side_bearing_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical); _glyf_get_side_bearing_var (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical);
HB_INTERNAL unsigned HB_INTERNAL unsigned
hb_ot_get_advance_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical); _glyf_get_advance_var (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical);
namespace OT { namespace OT {
@ -215,10 +215,10 @@ struct hmtxvmtx
if (unlikely (glyph >= num_metrics) || !font->num_coords) if (unlikely (glyph >= num_metrics) || !font->num_coords)
return side_bearing; return side_bearing;
if (var_table.get_blob () == &Null (hb_blob_t)) if (var_table.get_length ())
return hb_ot_get_side_bearing_var_tt (font, glyph, T::tableTag == HB_OT_TAG_vmtx); return side_bearing + var_table->get_side_bearing_var (glyph, font->coords, font->num_coords); // TODO Optimize?!
return side_bearing + var_table->get_side_bearing_var (glyph, font->coords, font->num_coords); // TODO Optimize?! return _glyf_get_side_bearing_var (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
#else #else
return side_bearing; return side_bearing;
#endif #endif
@ -249,10 +249,10 @@ struct hmtxvmtx
if (unlikely (glyph >= num_metrics) || !font->num_coords) if (unlikely (glyph >= num_metrics) || !font->num_coords)
return advance; return advance;
if (var_table.get_blob () == &Null (hb_blob_t)) if (var_table.get_length ())
return hb_ot_get_advance_var_tt (font, glyph, T::tableTag == HB_OT_TAG_vmtx); return advance + roundf (var_table->get_advance_var (font, glyph)); // TODO Optimize?!
return advance + roundf (var_table->get_advance_var (font, glyph)); // TODO Optimize?! return _glyf_get_advance_var (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
#else #else
return advance; return advance;
#endif #endif