[android] Fix calculation / clearing of cached glyph advance

#977
This commit is contained in:
Mikael Sand
2019-03-21 02:49:36 +02:00
parent 1106dbae2e
commit eaec9b9988
2 changed files with 15 additions and 1 deletions
@@ -70,6 +70,11 @@ class TSpanView extends TextView {
super.invalidate();
}
void clearCache() {
mCachedPath = null;
super.clearCache();
}
@Override
void draw(Canvas canvas, Paint paint, float opacity) {
if (mContent != null) {
@@ -51,7 +51,7 @@ class TextView extends GroupView {
return;
}
super.invalidate();
clearChildCache();
getTextContainer().clearChildCache();
}
void clearCache() {
@@ -246,4 +246,13 @@ class TextView extends GroupView {
return advance;
}
TextView getTextContainer() {
TextView node = this;
ViewParent parent = this.getParent();
while (parent instanceof TextView) {
node = (TextView) parent;
parent = node.getParent();
}
return node;
}
}