// this is a bit of a hack. It returns -1 if we're not on a leaf, and // the length of the leaf if we are on a leaf. private float onLeaf() { float[] curve = recCurveStack[recLevel]; float polyLen = 0; float x0 = curve[0], y0 = curve[1]; for (int i = 2; i < curveType; i += 2) { final float x1 = curve[i], y1 = curve[i + 1]; final float len = Helpers.linelen(x0, y0, x1, y1); polyLen += len; curLeafCtrlPolyLengths[i / 2 - 1] = len; x0 = x1; y0 = y1; } final float lineLen = Helpers.linelen(curve[0], curve[1], curve[curveType - 2], curve[curveType - 1]); if (polyLen - lineLen < ERR || recLevel == limit) { return (polyLen + lineLen) / 2; } return -1; }