impl #309 observe font face set changes

This commit is contained in:
Yanzhen Yu
2020-09-17 02:11:34 +08:00
parent 412f6ca95e
commit 2440701926
7 changed files with 121 additions and 4 deletions

View File

@@ -813,6 +813,22 @@ export class Replayer {
} catch (error) {
this.warnCanvasMutationFailed(d, d.id, error);
}
break;
}
case IncrementalSource.Font: {
try {
const fontFace = new FontFace(
d.family,
d.buffer ? new Uint8Array(JSON.parse(d.fontSource)) : d.fontSource,
d.descriptors,
);
this.iframe.contentDocument?.fonts.add(fontFace);
} catch (error) {
if (this.config.showWarning) {
console.warn(error);
}
}
break;
}
default:
}