[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
diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc
index 6924955..96f94e4 100644
--- a/src/hb-ot-font.cc
+++ b/src/hb-ot-font.cc
@@ -313,13 +313,13 @@
#ifndef HB_NO_VAR
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);
}
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);
}
diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh
index ce8f261..e20b372 100644
--- a/src/hb-ot-hmtx-table.hh
+++ b/src/hb-ot-hmtx-table.hh
@@ -43,10 +43,10 @@
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_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 {
@@ -215,10 +215,10 @@
if (unlikely (glyph >= num_metrics) || !font->num_coords)
return side_bearing;
- if (var_table.get_blob () == &Null (hb_blob_t))
- return hb_ot_get_side_bearing_var_tt (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
+ if (var_table.get_length ())
+ 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
return side_bearing;
#endif
@@ -249,10 +249,10 @@
if (unlikely (glyph >= num_metrics) || !font->num_coords)
return advance;
- if (var_table.get_blob () == &Null (hb_blob_t))
- return hb_ot_get_advance_var_tt (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
+ if (var_table.get_length ())
+ 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
return advance;
#endif