From 3ef590808fb57cc3879c86ed5bf4c7301a2237da Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 3 Jul 2022 12:44:24 -0600 Subject: [PATCH] [glyf] Internal flip a variable --- src/OT/glyf/glyf.hh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/OT/glyf/glyf.hh b/src/OT/glyf/glyf.hh index 62b51d72b..7783c0a87 100644 --- a/src/OT/glyf/glyf.hh +++ b/src/OT/glyf/glyf.hh @@ -194,7 +194,7 @@ struct glyf_accelerator_t hb_font_t *font; hb_glyph_extents_t *extents; contour_point_t *phantoms; - bool unscaled; + bool scaled; struct contour_bounds_t { @@ -210,7 +210,7 @@ struct glyf_accelerator_t bool empty () const { return (min_x >= max_x) || (min_y >= max_y); } - void get_extents (hb_font_t *font, hb_glyph_extents_t *extents, bool unscaled = false) + void get_extents (hb_font_t *font, hb_glyph_extents_t *extents, bool scaled = true) { if (unlikely (empty ())) { @@ -220,37 +220,37 @@ struct glyf_accelerator_t extents->y_bearing = 0; return; } - if (unscaled) - { - extents->x_bearing = roundf (min_x); - extents->width = roundf (max_x - extents->x_bearing); - extents->y_bearing = roundf (max_y); - extents->height = roundf (min_y - extents->y_bearing); - } - else + if (scaled) { extents->x_bearing = font->em_scalef_x (min_x); extents->width = font->em_scalef_x (max_x) - extents->x_bearing; extents->y_bearing = font->em_scalef_y (max_y); extents->height = font->em_scalef_y (min_y) - extents->y_bearing; } + else + { + extents->x_bearing = roundf (min_x); + extents->width = roundf (max_x - extents->x_bearing); + extents->y_bearing = roundf (max_y); + extents->height = roundf (min_y - extents->y_bearing); + } } protected: float min_x, min_y, max_x, max_y; } bounds; - points_aggregator_t (hb_font_t *font_, hb_glyph_extents_t *extents_, contour_point_t *phantoms_, bool unscaled_ = false) + points_aggregator_t (hb_font_t *font_, hb_glyph_extents_t *extents_, contour_point_t *phantoms_, bool scaled_ = true) { font = font_; extents = extents_; phantoms = phantoms_; - unscaled = unscaled_; + scaled = scaled_; if (extents) bounds = contour_bounds_t (); } void consume_point (const contour_point_t &point) { bounds.add (point); } - void points_end () { bounds.get_extents (font, extents, unscaled); } + void points_end () { bounds.get_extents (font, extents, scaled); } bool is_consuming_contour_points () { return extents; } contour_point_t *get_phantoms_sink () { return phantoms; } @@ -288,7 +288,7 @@ struct glyf_accelerator_t hb_glyph_extents_t extents; contour_point_t phantoms[glyf_impl::PHANTOM_COUNT]; - if (unlikely (!get_points (font, gid, points_aggregator_t (font, &extents, phantoms, true)))) + if (unlikely (!get_points (font, gid, points_aggregator_t (font, &extents, phantoms, false)))) return #ifndef HB_NO_VERTICAL is_vertical ? vmtx->get_side_bearing (gid) :