SVG_TRANSFORM_ATTRIBUTE, s, ctx);
pathShape = tr.createTransformedShape(pathShape);
}
// create the TextPath object that we are going to return
TextPath textPath = new TextPath(new GeneralPath(pathShape));
// set the start offset if specified
s = textPathElement.getAttributeNS(null, SVG_START_OFFSET_ATTRIBUTE);
if (s.length() > 0) {
float startOffset = 0;
int percentIndex = s.indexOf('%');
if (percentIndex != -1) {
// its a percentage of the length of the path
float pathLength = textPath.lengthOfPath();
String percentString = s.substring(0,percentIndex);
float startOffsetPercent = 0;
try {
startOffsetPercent = SVGUtilities.convertSVGNumber(percentString);
} catch (NumberFormatException e) {
startOffsetPercent = -1;
}
if (startOffsetPercent < 0) {
throw new BridgeException
(ctx, textPathElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object[] {SVG_START_OFFSET_ATTRIBUTE, s});
}
startOffset = (float)(startOffsetPercent * pathLength/100.0);
} else {
// its an absolute length
UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, textPathElement);
startOffset = UnitProcessor.svgOtherLengthToUserSpace(s, SVG_START_OFFSET_ATTRIBUTE, uctx);
}
textPath.setStartOffset(startOffset);
}
return textPath;
}