//logger.info("Advx " + glyph.getAdvanceWidth());
int offset = 0;
//float originx = 0F,originy = 0F;
CustomPathHandler pathHandler = new CustomPathHandler();
while (offset < count) {
Point point = glyph.getPoint(startIndex + offset%count);
Point point_plus1 = glyph.getPoint(startIndex + (offset+1)%count);
Point point_plus2 = glyph.getPoint(startIndex + (offset+2)%count);
float pointx = ((float)point.x);
float pointy = ((float)point.y);
float point_plus1x = ((float)point_plus1.x);
float point_plus1y = ((float)point_plus1.y);
float point_plus2x = ((float)point_plus2.x);
float point_plus2y = ((float)point_plus2.y);
if (offset == 0) {
pathHandler.movetoAbs(pointx,pointy);
}
if (point.onCurve && point_plus1.onCurve) {
// line command
pathHandler.linetoAbs(point_plus1x,point_plus1y);
offset++;
} else if (point.onCurve && !point_plus1.onCurve && point_plus2.onCurve) {
// This is a curve with no implied points
// quadratic bezier command
pathHandler.curvetoQuadraticAbs(point_plus1x, point_plus1y, point_plus2x, point_plus2y);
offset+=2;
} else if (point.onCurve && !point_plus1.onCurve && !point_plus2.onCurve) {
// This is a curve with one implied point
pathHandler.curvetoQuadraticAbs(point_plus1x, point_plus1y, midValue(point_plus1x, point_plus2x), midValue(point_plus1y, point_plus2y));
offset+=2;
} else if (!point.onCurve && !point_plus1.onCurve) {
// This is a curve with two implied points
// quadratic bezier with
pathHandler.curvetoQuadraticAbs(pointx, pointy, midValue(pointx, point_plus1x), midValue(pointy, point_plus1y));
offset++;
} else if (!point.onCurve && point_plus1.onCurve) {
// This is a curve with no implied points
pathHandler.curvetoQuadraticAbs(pointx, pointy, point_plus1x, point_plus1y);
offset++;
} else {
logger.info("drawGlyph case not catered for!!");
break;
}
}
pathHandler.closePath();
Vertex[] p = pathHandler.getPathPointsArray();
/*
//Get Sub-Paths
ArrayList<Vertex[]> subPaths = pathHandler.getContours();