[android] Support other elements than Path as href in TextPath

This commit is contained in:
Mikael Sand
2018-09-22 13:11:28 +03:00
parent ff47aa4907
commit 35597ed772
3 changed files with 6 additions and 6 deletions
@@ -102,7 +102,7 @@ class TSpanShadowNode extends TextShadowNode {
boolean isClosed = false;
final boolean hasTextPath = textPath != null;
if (hasTextPath) {
pm = new PathMeasure(textPath.getPath(), false);
pm = new PathMeasure(textPath.getTextPath(canvas, paint), false);
pathLength = pm.getLength();
isClosed = pm.isClosed();
if (pathLength == 0) {
@@ -987,7 +987,7 @@ public class TextLayoutAlgorithm {
*/
final TextPathShadowNode textPathShadowNode = inTextPath.get(index);
if (textPathShadowNode != null && result[index].addressable) {
textPath = textPathShadowNode.getPath();
textPath = textPathShadowNode.getTextPath(null, null);
inPath = true;
/*
@@ -92,17 +92,17 @@ class TextPathShadowNode extends TextShadowNode {
drawGroup(canvas, paint, opacity);
}
public Path getPath() {
public Path getTextPath(Canvas canvas, Paint paint) {
SvgViewShadowNode svg = getSvgShadowNode();
VirtualNode template = svg.getDefinedTemplate(mHref);
if (template == null || template.getClass() != PathShadowNode.class) {
if (template == null || !(template instanceof RenderableShadowNode)) {
// warning about this.
return null;
}
PathShadowNode path = (PathShadowNode)template;
return path.getPath();
RenderableShadowNode shadowNode = (RenderableShadowNode)template;
return shadowNode.getPath(canvas, paint);
}
@Override