Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid splitting surrogate pairs when breaking runs for scaling #4731

Merged
1 commit merged into from
Feb 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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