Exemplo n.º 1
0
  /** 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;
  }
Exemplo n.º 2
0
 public PointRec(GlyfSimple g, int idx) {
   this.x = g.getXCoord(idx);
   this.y = g.getYCoord(idx);
   this.onCurve = g.onCurve(idx);
 }