SkCustomTypefaceBuilder to set SkFontStyle
Allow the user of SkCustomTypefaceBuilder to set the SkFontStyle of the
resulting SkTypeface. This allows users to build font families.
Fix the Font_flatten test to actually work (instead of relying on the
magic behavior of nullptr for SkTypeface), add a test with the custom
typeface, and reduce the number of times the inner loop runs from
302,400 times to 4,032 times so that the test finishes in a reasonable
amount of time.
Bug: skia:10630
Change-Id: I0b5e939552ee4a9a1249eefbb7a7279a59b38e5a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311596
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Xiao Yu <xster@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/gm/userfont.cpp b/gm/userfont.cpp
index 7be73d7..b40410e 100644
--- a/gm/userfont.cpp
+++ b/gm/userfont.cpp
@@ -32,6 +32,7 @@
font.getMetrics(&metrics);
builder.setMetrics(metrics, 1.0f/upem);
}
+ builder.setFontStyle(font.getTypefaceOrDefault()->fontStyle());
// Steal the first 128 chars from the default font
for (SkGlyphID index = 0; index <= 127; ++index) {