[canvaskit] Allow users to load their own fonts
Instead of using the test font(s), now ship with a small
(100k) Monospace font. This can be disabled by:
compile.sh no_font ...
This saves about 350k (164k gzipped) in binary size.
Bug: skia:
Change-Id: I195e3b35bea86d0f096066c1c6a44a4b602571f3
Reviewed-on: https://skia-review.googlesource.com/c/176580
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 201b86c..42cc2c8 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -69,8 +69,8 @@
skia_use_sfntly = skia_use_icu
skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
skia_enable_fontmgr_empty = false
- skia_enable_fontmgr_custom = (is_linux || target_cpu == "wasm") &&
- skia_use_freetype && !skia_use_fontconfig
+ skia_enable_fontmgr_custom =
+ is_linux && skia_use_freetype && !skia_use_fontconfig
skia_enable_fontmgr_custom_empty = is_fuchsia && skia_use_freetype
skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype
skia_enable_fontmgr_fuchsia = is_fuchsia
@@ -414,6 +414,20 @@
]
}
+optional("fontmgr_wasm") {
+ enabled = target_cpu == "wasm"
+
+ deps = [
+ ":typeface_freetype",
+ ]
+ sources = [
+ "src/ports/SkFontMgr_custom.cpp",
+ "src/ports/SkFontMgr_custom.h",
+ "src/ports/SkFontMgr_custom_embedded.cpp",
+ "src/ports/SkFontMgr_custom_embedded_factory.cpp",
+ ]
+}
+
optional("fontmgr_fuchsia") {
enabled = skia_enable_fontmgr_fuchsia
@@ -872,6 +886,7 @@
":fontmgr_empty",
":fontmgr_fontconfig",
":fontmgr_fuchsia",
+ ":fontmgr_wasm",
":heif",
":hsw",
":jpeg",