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>
This commit is contained in:
Ben Wagner 2019-05-30 10:32:15 -04:00
parent 5093e23de6
commit bd8c724fd4

View File

@ -123,6 +123,7 @@ void SkShaperPrimitive::shape(const char* utf8, size_t utf8Bytes,
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 @@ void SkShaperPrimitive::shape(const char* utf8, size_t utf8Bytes,
SkScalar width,
RunHandler* handler) const {
sk_ignore_unused_variable(leftToRight);
SkASSERT(font.getTypeface());
int glyphCount = font.countText(utf8, utf8Bytes, SkTextEncoding::kUTF8);
if (glyphCount <= 0) {