Fixing the worst case when text cannot be resolved at all

(hanging on Mac)
Bug: skia:11996

Change-Id: I4dcd8175d0d4440a7c7ef73be26508018ad86c46
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/412661
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
This commit is contained in:
Julia Lavrova 2021-05-26 13:48:58 -04:00 committed by Skia Commit-Bot
parent 7377afb851
commit 658d96662b

View File

@ -487,6 +487,7 @@ void OneLineShaper::matchResolvedFonts(const TextStyle& textStyle,
if (fParagraph->fFontCollection->fontFallbackEnabled()) {
// Give fallback a clue
// Some unresolved subblocks might be resolved with different fallback fonts
std::vector<RunBlock> hopelessBlocks;
while (!fUnresolvedBlocks.empty()) {
auto unresolvedRange = fUnresolvedBlocks.front().fText;
auto unresolvedText = fParagraph->text(unresolvedRange);
@ -527,6 +528,8 @@ void OneLineShaper::matchResolvedFonts(const TextStyle& textStyle,
if (ch == unresolvedText.end()) {
// Not a single codepoint could be resolved but we finished the block
hopelessBlocks.push_back(fUnresolvedBlocks.front());
fUnresolvedBlocks.pop_front();
break;
}
@ -540,7 +543,10 @@ void OneLineShaper::matchResolvedFonts(const TextStyle& textStyle,
}
}
}
}
for (auto& block : hopelessBlocks) {
fUnresolvedBlocks.emplace_front(block);
}
}
}