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

AtlasEngine: Fix support for font features #15912

Merged
merged 1 commit into from
Aug 31, 2023
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
10 changes: 10 additions & 0 deletions src/renderer/atlas/AtlasEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,9 @@ void AtlasEngine::_flushBufferLine()

const auto initialIndicesCount = row.glyphIndices.size();

// GetTextComplexity() returns as many glyph indices as its textLength parameter (here: mappedLength).
// This block ensures that the buffer has sufficient capacity. It also initializes the glyphProps buffer because it and
// glyphIndices sort of form a "pair" in the _mapComplex() code and are always simultaneously resized there as well.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (mappedLength > _api.glyphIndices.size())
{
auto size = _api.glyphIndices.size();
Expand All @@ -658,6 +661,8 @@ void AtlasEngine::_flushBufferLine()
_api.glyphProps = Buffer<DWRITE_SHAPING_GLYPH_PROPERTIES>{ size };
}

if (_api.s->font->fontFeatures.empty())
{
// We can reuse idx here, as it'll be reset to "idx = mappedEnd" in the outer loop anyways.
for (u32 complexityLength = 0; idx < mappedEnd; idx += complexityLength)
{
Expand Down Expand Up @@ -686,6 +691,11 @@ void AtlasEngine::_flushBufferLine()
_mapComplex(mappedFontFace.get(), idx, complexityLength, row);
}
}
}
else
{
_mapComplex(mappedFontFace.get(), idx, mappedLength, row);
}

const auto indicesCount = row.glyphIndices.size();
if (indicesCount > initialIndicesCount)
Expand Down
Loading