From 60262e4ca9dc8acd740e47b14d6e7b586c16ceac Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sat, 29 Feb 2020 22:57:59 +0330 Subject: [PATCH] [var] Build end-points array on gvar itself --- src/hb-ot-glyf-table.hh | 13 +++---------- src/hb-ot-var-gvar-table.hh | 8 ++++++-- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index df95a820c..d898371c0 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -574,7 +574,6 @@ struct glyf } bool get_contour_points (contour_point_vector_t &points_ /* OUT */, - hb_vector_t &end_points_ /* OUT */, bool phantom_only = false) const { const HBUINT16 *endPtsOfContours = &StructAfter (header); @@ -586,13 +585,8 @@ struct glyf for (unsigned int i = 0; i < points_.length; i++) points_[i].init (); if (phantom_only) return true; - end_points_.resize (num_contours); - for (int i = 0; i < num_contours; i++) - { - end_points_[i] = endPtsOfContours[i]; points_[endPtsOfContours[i]].is_end_point = true; - } /* Skip instructions */ const HBUINT8 *p = &StructAtOffset (&endPtsOfContours[num_contours + 1], @@ -709,7 +703,6 @@ struct glyf { if (unlikely (depth > HB_MAX_NESTING_LEVEL)) return false; contour_point_vector_t points; - hb_vector_t end_points; switch (type) { case COMPOSITE: @@ -722,7 +715,7 @@ struct glyf break; } case SIMPLE: - if (unlikely (!SimpleGlyph (*header, bytes).get_contour_points (points, end_points, phantom_only))) + if (unlikely (!SimpleGlyph (*header, bytes).get_contour_points (points, phantom_only))) return false; break; default: return false; /* empty glyph */ @@ -746,8 +739,8 @@ struct glyf } #ifndef HB_NO_VAR - if (unlikely (!face->table.gvar->apply_deltas_to_points (gid, font->coords, font->num_coords, - points.as_array (), end_points.as_array ()))) return false; + if (unlikely (!face->table.gvar->apply_deltas_to_points (gid, font->coords, font->num_coords, points.as_array ()))) + return false; #endif switch (type) { diff --git a/src/hb-ot-var-gvar-table.hh b/src/hb-ot-var-gvar-table.hh index 82bc6672a..7861bd47b 100644 --- a/src/hb-ot-var-gvar-table.hh +++ b/src/hb-ot-var-gvar-table.hh @@ -546,8 +546,7 @@ struct gvar public: bool apply_deltas_to_points (hb_codepoint_t glyph, const int *coords, unsigned int coord_count, - const hb_array_t points, - const hb_array_t end_points) const + const hb_array_t points) const { coord_count = hb_min (coord_count, gvar_table->axisCount); if (!coord_count || coord_count != gvar_table->axisCount) return true; @@ -569,6 +568,11 @@ struct gvar contour_point_vector_t deltas; /* flag is used to indicate referenced point */ deltas.resize (points.length); + hb_vector_t end_points; + for (unsigned i = 0; i < points.length; ++i) + if (points[i].is_end_point) + end_points.push (i); + do { float scalar = iterator.current_tuple->calculate_scalar (coords, coord_count, shared_tuples.as_array ());