[glyf] Internal flip a variable

This commit is contained in:
Behdad Esfahbod 2022-07-03 12:44:24 -06:00
parent b07fa2bb1a
commit 3ef590808f
1 changed files with 14 additions and 14 deletions

View File

@ -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) :