|
|
|
@ -42,13 +42,13 @@ struct path_builder_t |
|
|
|
|
void consume_point (const contour_point_t &point) |
|
|
|
|
{ |
|
|
|
|
bool is_on_curve = point.flag & glyf_impl::SimpleGlyph::FLAG_ON_CURVE; |
|
|
|
|
optional_point_t p (point.x, point.y); |
|
|
|
|
optional_point_t p (font->em_fscalef_x (point.x), font->em_fscalef_y (point.y)); |
|
|
|
|
if (!first_oncurve) |
|
|
|
|
{ |
|
|
|
|
if (is_on_curve) |
|
|
|
|
{ |
|
|
|
|
first_oncurve = p; |
|
|
|
|
draw_session->move_to (font->em_fscalef_x (p.x), font->em_fscalef_y (p.y)); |
|
|
|
|
draw_session->move_to (p.x, p.y); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -57,7 +57,7 @@ struct path_builder_t |
|
|
|
|
optional_point_t mid = first_offcurve.lerp (p, .5f); |
|
|
|
|
first_oncurve = mid; |
|
|
|
|
last_offcurve = p; |
|
|
|
|
draw_session->move_to (font->em_fscalef_x (mid.x), font->em_fscalef_y (mid.y)); |
|
|
|
|
draw_session->move_to (mid.x, mid.y); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
first_offcurve = p; |
|
|
|
@ -69,22 +69,22 @@ struct path_builder_t |
|
|
|
|
{ |
|
|
|
|
if (is_on_curve) |
|
|
|
|
{ |
|
|
|
|
draw_session->quadratic_to (font->em_fscalef_x (last_offcurve.x), font->em_fscalef_y (last_offcurve.y), |
|
|
|
|
font->em_fscalef_x (p.x), font->em_fscalef_y (p.y)); |
|
|
|
|
draw_session->quadratic_to (last_offcurve.x, last_offcurve.y, |
|
|
|
|
p.x, p.y); |
|
|
|
|
last_offcurve = optional_point_t (); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
optional_point_t mid = last_offcurve.lerp (p, .5f); |
|
|
|
|
draw_session->quadratic_to (font->em_fscalef_x (last_offcurve.x), font->em_fscalef_y (last_offcurve.y), |
|
|
|
|
font->em_fscalef_x (mid.x), font->em_fscalef_y (mid.y)); |
|
|
|
|
draw_session->quadratic_to (last_offcurve.x, last_offcurve.y, |
|
|
|
|
mid.x, mid.y); |
|
|
|
|
last_offcurve = p; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (is_on_curve) |
|
|
|
|
draw_session->line_to (font->em_fscalef_x (p.x), font->em_fscalef_y (p.y)); |
|
|
|
|
draw_session->line_to (p.x, p.y); |
|
|
|
|
else |
|
|
|
|
last_offcurve = p; |
|
|
|
|
} |
|
|
|
@ -95,23 +95,23 @@ struct path_builder_t |
|
|
|
|
if (first_offcurve && last_offcurve) |
|
|
|
|
{ |
|
|
|
|
optional_point_t mid = last_offcurve.lerp (first_offcurve, .5f); |
|
|
|
|
draw_session->quadratic_to (font->em_fscalef_x (last_offcurve.x), font->em_fscalef_y (last_offcurve.y), |
|
|
|
|
font->em_fscalef_x (mid.x), font->em_fscalef_y (mid.y)); |
|
|
|
|
draw_session->quadratic_to (last_offcurve.x, last_offcurve.y, |
|
|
|
|
mid.x, mid.y); |
|
|
|
|
last_offcurve = optional_point_t (); |
|
|
|
|
/* now check the rest */ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (first_offcurve && first_oncurve) |
|
|
|
|
draw_session->quadratic_to (font->em_fscalef_x (first_offcurve.x), font->em_fscalef_y (first_offcurve.y), |
|
|
|
|
font->em_fscalef_x (first_oncurve.x), font->em_fscalef_y (first_oncurve.y)); |
|
|
|
|
draw_session->quadratic_to (first_offcurve.x, first_offcurve.y, |
|
|
|
|
first_oncurve.x, first_oncurve.y); |
|
|
|
|
else if (last_offcurve && first_oncurve) |
|
|
|
|
draw_session->quadratic_to (font->em_fscalef_x (last_offcurve.x), font->em_fscalef_y (last_offcurve.y), |
|
|
|
|
font->em_fscalef_x (first_oncurve.x), font->em_fscalef_y (first_oncurve.y)); |
|
|
|
|
draw_session->quadratic_to (last_offcurve.x, last_offcurve.y, |
|
|
|
|
first_oncurve.x, first_oncurve.y); |
|
|
|
|
else if (first_oncurve) |
|
|
|
|
draw_session->line_to (font->em_fscalef_x (first_oncurve.x), font->em_fscalef_y (first_oncurve.y)); |
|
|
|
|
draw_session->line_to (first_oncurve.x, first_oncurve.y); |
|
|
|
|
else if (first_offcurve) |
|
|
|
|
{ |
|
|
|
|
float x = font->em_fscalef_x (first_offcurve.x), y = font->em_fscalef_x (first_offcurve.y); |
|
|
|
|
float x = first_offcurve.x, y = first_offcurve.y; |
|
|
|
|
draw_session->move_to (x, y); |
|
|
|
|
draw_session->quadratic_to (x, y, x, y); |
|
|
|
|
} |
|
|
|
|