Correct shaper assert around iterator fonts.
The assert here was intended to catch the case where a font run iterator
produced a font without specifying a typeface. This should never happen.
However, it is currently fine for the user to pass in a font without
specifying a typeface, which really means they don't care.
Change-Id: Ib63430142b9a05b4f2f8603e7a56a0ac09fa219f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216874
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
diff --git a/modules/skshaper/src/SkShaper_primitive.cpp b/modules/skshaper/src/SkShaper_primitive.cpp
index 955f842..48035f0 100644
--- a/modules/skshaper/src/SkShaper_primitive.cpp
+++ b/modules/skshaper/src/SkShaper_primitive.cpp
@@ -123,6 +123,7 @@
RunHandler* handler) const
{
font.consume();
+ SkASSERT(font.currentFont().getTypeface());
bidi.consume();
return this->shape(utf8, utf8Bytes, font.currentFont(), (bidi.currentLevel() % 2) == 0,
width, handler);
@@ -134,7 +135,6 @@
SkScalar width,
RunHandler* handler) const {
sk_ignore_unused_variable(leftToRight);
- SkASSERT(font.getTypeface());
int glyphCount = font.countText(utf8, utf8Bytes, SkTextEncoding::kUTF8);
if (glyphCount <= 0) {