Skip to content

Commit

Permalink
Don't split surrogate pairs when breaking runs for scaling. Affects e…
Browse files Browse the repository at this point in the history
…moji rendering. #4704
  • Loading branch information
miniksa committed Feb 26, 2020
1 parent de5e72f commit f892200
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/renderer/dx/CustomTextLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,16 @@ CustomTextLayout::CustomTextLayout(gsl::not_null<IDWriteFactory1*> const factory
// If scale corrections were needed, we need to split the run.
for (auto [index, scale] : _glyphScaleCorrections)
{
// Don't split in the middle of a surrogate pair.
const auto after = IS_HIGH_SURROGATE(_text.at(index)) ? 2 : 1;

// Split after the adjustment first so it
// takes a copy of all the run properties before we modify them.
// GH 4665: This is the other half of the potential future perf item.
// If glyphs needing the same scale are coalesced, we could
// break fewer times and have fewer runs.
_SetCurrentRun(index + 1);
_SplitCurrentRun(index + 1);
_SetCurrentRun(index + after);
_SplitCurrentRun(index + after);

// Now split just this glyph off.
_SetCurrentRun(index);
Expand Down

0 comments on commit f892200

Please sign in to comment.