/** Render a simple glyf */ protected GeneralPath renderSimpleGlyph(GlyfSimple g) { // the current contour int curContour = 0; // the render state RenderState rs = new RenderState(); rs.gp = new GeneralPath(); for (int i = 0; i < g.getNumPoints(); i++) { PointRec rec = new PointRec(g, i); if (rec.onCurve) { addOnCurvePoint(rec, rs); } else { addOffCurvePoint(rec, rs); } // see if we just ended a contour if (i == g.getContourEndPoint(curContour)) { curContour++; if (rs.firstOff != null) { addOffCurvePoint(rs.firstOff, rs); } if (rs.firstOn != null) { addOnCurvePoint(rs.firstOn, rs); } rs.firstOn = null; rs.firstOff = null; rs.prevOff = null; } } return rs.gp; }
public PointRec(GlyfSimple g, int idx) { this.x = g.getXCoord(idx); this.y = g.getYCoord(idx); this.onCurve = g.onCurve(idx); }