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