Skip to content

Commit

Permalink
Added shortcut when DWrite analysis in not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
skyline75489 committed Oct 12, 2019
1 parent abf3ee5 commit 72712da
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/renderer/dx/CustomTextLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,20 @@ CustomTextLayout::CustomTextLayout(gsl::not_null<IDWriteFactory1*> const factory
// Allocate enough room to have one breakpoint per code unit.
_breakpoints.resize(_text.size());

// Call each of the analyzers in sequence, recording their results.
RETURN_IF_FAILED(_analyzer->AnalyzeLineBreakpoints(this, 0, textLength, this));
RETURN_IF_FAILED(_analyzer->AnalyzeBidi(this, 0, textLength, this));
RETURN_IF_FAILED(_analyzer->AnalyzeScript(this, 0, textLength, this));
RETURN_IF_FAILED(_analyzer->AnalyzeNumberSubstitution(this, 0, textLength, this));
// Perform our custom font fallback analyzer that mimics the pattern of the real analyzers.
RETURN_IF_FAILED(_AnalyzeFontFallback(this, 0, textLength));
BOOL isTextSimple = FALSE;
UINT32 uiReadLength = 0;
RETURN_IF_FAILED(_analyzer->GetTextComplexity(_text.c_str(), textLength, _font.Get(), &isTextSimple, &uiReadLength, NULL));

if (!isTextSimple)
{
// Call each of the analyzers in sequence, recording their results.
RETURN_IF_FAILED(_analyzer->AnalyzeLineBreakpoints(this, 0, textLength, this));
RETURN_IF_FAILED(_analyzer->AnalyzeBidi(this, 0, textLength, this));
RETURN_IF_FAILED(_analyzer->AnalyzeScript(this, 0, textLength, this));
RETURN_IF_FAILED(_analyzer->AnalyzeNumberSubstitution(this, 0, textLength, this));
// Perform our custom font fallback analyzer that mimics the pattern of the real analyzers.
RETURN_IF_FAILED(_AnalyzeFontFallback(this, 0, textLength));
}

// Ensure that a font face is attached to every run
for (auto& run : _runs)
Expand Down

0 comments on commit 72712da

Please sign in to comment.