[glyf] Internal flip a variable
This commit is contained in:
parent
b07fa2bb1a
commit
3ef590808f
|
@ -194,7 +194,7 @@ struct glyf_accelerator_t
|
||||||
hb_font_t *font;
|
hb_font_t *font;
|
||||||
hb_glyph_extents_t *extents;
|
hb_glyph_extents_t *extents;
|
||||||
contour_point_t *phantoms;
|
contour_point_t *phantoms;
|
||||||
bool unscaled;
|
bool scaled;
|
||||||
|
|
||||||
struct contour_bounds_t
|
struct contour_bounds_t
|
||||||
{
|
{
|
||||||
|
@ -210,7 +210,7 @@ struct glyf_accelerator_t
|
||||||
|
|
||||||
bool empty () const { return (min_x >= max_x) || (min_y >= max_y); }
|
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 ()))
|
if (unlikely (empty ()))
|
||||||
{
|
{
|
||||||
|
@ -220,37 +220,37 @@ struct glyf_accelerator_t
|
||||||
extents->y_bearing = 0;
|
extents->y_bearing = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (unscaled)
|
if (scaled)
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
{
|
||||||
extents->x_bearing = font->em_scalef_x (min_x);
|
extents->x_bearing = font->em_scalef_x (min_x);
|
||||||
extents->width = font->em_scalef_x (max_x) - extents->x_bearing;
|
extents->width = font->em_scalef_x (max_x) - extents->x_bearing;
|
||||||
extents->y_bearing = font->em_scalef_y (max_y);
|
extents->y_bearing = font->em_scalef_y (max_y);
|
||||||
extents->height = font->em_scalef_y (min_y) - extents->y_bearing;
|
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:
|
protected:
|
||||||
float min_x, min_y, max_x, max_y;
|
float min_x, min_y, max_x, max_y;
|
||||||
} bounds;
|
} 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_;
|
font = font_;
|
||||||
extents = extents_;
|
extents = extents_;
|
||||||
phantoms = phantoms_;
|
phantoms = phantoms_;
|
||||||
unscaled = unscaled_;
|
scaled = scaled_;
|
||||||
if (extents) bounds = contour_bounds_t ();
|
if (extents) bounds = contour_bounds_t ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void consume_point (const contour_point_t &point) { bounds.add (point); }
|
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; }
|
bool is_consuming_contour_points () { return extents; }
|
||||||
contour_point_t *get_phantoms_sink () { return phantoms; }
|
contour_point_t *get_phantoms_sink () { return phantoms; }
|
||||||
|
@ -288,7 +288,7 @@ struct glyf_accelerator_t
|
||||||
hb_glyph_extents_t extents;
|
hb_glyph_extents_t extents;
|
||||||
|
|
||||||
contour_point_t phantoms[glyf_impl::PHANTOM_COUNT];
|
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
|
return
|
||||||
#ifndef HB_NO_VERTICAL
|
#ifndef HB_NO_VERTICAL
|
||||||
is_vertical ? vmtx->get_side_bearing (gid) :
|
is_vertical ? vmtx->get_side_bearing (gid) :
|
||||||
|
|
Loading…
Reference in New Issue