[canvaskit] Canvas API for loading fonts
There's the barest hint of a "font manager" here.
Basically, nothing smart to deal with bold or fallbacks.
Maybe one day, we'll expose
SkTypeface* matchStyleCSS3(const SkFontStyle& pattern);
and do smart things for fallbacks, but for now that's not
in the immediate future.
Docs-Preview: https://skia.org/?cl=177067
Bug: skia:
Change-Id: Iaeabcbf5ff4511a01b37c16c983e447c25b0e3e7
Reviewed-on: https://skia-review.googlesource.com/c/177067
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/experimental/canvaskit/interface.js b/experimental/canvaskit/interface.js
index 704721a..fe1252c 100644
--- a/experimental/canvaskit/interface.js
+++ b/experimental/canvaskit/interface.js
@@ -412,16 +412,9 @@
if (!font) {
SkDebug('Could not decode font data');
// We do not need to free the data since the C++ will do that for us
- // on a failed decode (at least, it appears to).
+ // when the font is deleted (or fails to decode);
return null;
}
- // We cannot free this data until after the font stops being used
- // (otherwise nothing draws)
- var realDelete = font.delete.bind(font);
- font.delete = function() {
- CanvasKit._free(fptr);
- realDelete();
- }
return font;
}