+
+ DrawGlyphSegment(p, p1, p2, p3);
+
+ p1 = p2;
+ p2 = p3;
+ }
+}
+
+
+//
+// Draw a glyph segment given 3 points
+//
+void EditWindow::DrawGlyphSegment(Painter & p, IPoint p1, IPoint p2, IPoint p3)
+{
+ if (p2.onCurve)
+ {
+ // Skip drawing if the middle point is on curve and the last is off
+ if (p3.onCurve)
+ p.DrawLine(p2, p3);
+ }
+ else
+ {
+ // The middle point is off curve, and so we need to draw a Bezier curve.
+ // Also, depending on whether or not the previous or follow points are
+ // off curve, we need to draw to the midpoints if so.
+ IPoint mid12 = IPoint((p1.x + p2.x) / 2, (p1.y + p2.y) / 2);
+ IPoint mid23 = IPoint((p2.x + p3.x) / 2, (p2.y + p3.y) / 2);
+ p.DrawBezier((p1.onCurve ? p1 : mid12), p2, (p3.onCurve ? p3 : mid23));