+ else
+ {
+ // Skip point if it's on curve (start of curve--it's already
+ // been plotted so we don't need to handle it...)
+ if (glyph.GetOnCurve(poly, i))
+ continue;
+
+ // We are now guaranteed that we are sitting on a curve control point
+ // (off curve). Figure the extent of the curve: If the following is a
+ // curve control point, then use the midpoint to it otherwise go to
+ // the next point since it's on curve.
+ IPoint pt2 = (glyph.GetNextOnCurve(poly, i)
+ ? glyph.GetNextPoint(poly, i) : glyph.GetMidpointToNext(poly, i));
+
+ Bezier(p, pt, glyph.GetPoint(poly, i), pt2);
+ pt = pt2;
+ }
+ }
+#else
+ DrawGlyphPoly(p, glyph, poly);
+#endif
+ }
+}
+
+
+/*
+So, to make it draw the point the pointer is pointing at, we need to do something. Either patch the GlyphPoints to handle it, or insert the point into the GlyphPoints and delete it if the user changes tools. Either way, need
+to change the color of the line(s) drawn to the point to signal to the user
+that it isn't finalized until they click the button.
+*/
+void EditWindow::DrawGlyphPoly(Painter & p, GlyphPoints & glyph, uint16_t poly)
+{
+ // Sanity check
+ if (glyph.GetNumPoints(poly) < 3)
+ return;
+
+ IPoint p1 = glyph.GetPrevPoint(poly, 0);
+ IPoint p2 = glyph.GetPoint(poly, 0);
+
+ // Inject the new poly point into the current polygon
+ if ((tool == TOOLAddPoly) && (poly == (glyph.GetNumPolys() - 1)))
+ {
+ p1 = IPoint(addPoint.x, addPoint.y, addPointOnCurve);
+ }
+
+ for(int i=0; i<glyph.GetNumPoints(poly); i++)
+ {
+ IPoint p3 = glyph.GetNextPoint(poly, i);
+
+ if ((tool == TOOLAddPoly) && (poly == (glyph.GetNumPolys() - 1))
+ && (i == (glyph.GetNumPoints(poly) - 1)))
+ {
+ p3 = IPoint(addPoint.x, addPoint.y, addPointOnCurve);
+ p.SetPen(QPen(Qt::green, 1.0, Qt::SolidLine));
+ DrawGlyphSegment(p, p1, p2, p3);
+ p1 = p2;
+ p2 = p3;
+ p3 = glyph.GetNextPoint(poly, i);