-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Fine-grained DWrite text analysis based on text complexity #9156
Copy link
Copy link
Closed
Labels
Area-RenderingText rendering, emoji, complex glyph & font-fallback issuesText rendering, emoji, complex glyph & font-fallback issuesIssue-TaskIt's a feature request, but it doesn't really need a major design.It's a feature request, but it doesn't really need a major design.Needs-Tag-FixDoesn't match tag requirementsDoesn't match tag requirementsProduct-ConhostFor issues in the Console codebaseFor issues in the Console codebaseProduct-TerminalThe new Windows Terminal.The new Windows Terminal.
Milestone
Description
Description of the new feature/enhancement
Inspired by microsoft/cascadia-code#411, certain ASCII characters sometimes break the simplicity of the entire text, depending on the font being used. The current implementation skips dwrite analysis when the entire text is simple:
if (!_isEntireTextSimple)
{
// Call each of the analyzers in sequence, recording their results.
RETURN_IF_FAILED(_fontRenderData->Analyzer()->AnalyzeLineBreakpoints(this, 0, textLength, this));
RETURN_IF_FAILED(_fontRenderData->Analyzer()->AnalyzeBidi(this, 0, textLength, this));
RETURN_IF_FAILED(_fontRenderData->Analyzer()->AnalyzeScript(this, 0, textLength, this));
RETURN_IF_FAILED(_fontRenderData->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));
}With for example Fira Code, in most cases the optimization only applies to lines with 120 spaces, which is not good.
Proposed technical implementation details (optional)
GetTextComplexity can provide a breakdown report of the text, showing which specific range of the text is simple, we should be able to utilize it like this:
for (auto range : complexRanges)
{
// Call each of the analyzers in sequence, recording their results.
RETURN_IF_FAILED(_fontRenderData->Analyzer()->AnalyzeLineBreakpoints(this, range, this));
RETURN_IF_FAILED(_fontRenderData->Analyzer()->AnalyzeBidi(this, range , this));
RETURN_IF_FAILED(_fontRenderData->Analyzer()->AnalyzeScript(this, range , this));
RETURN_IF_FAILED(_fontRenderData->Analyzer()->AnalyzeNumberSubstitution(this, range, this));
// Perform our custom font fallback analyzer that mimics the pattern of the real analyzers.
RETURN_IF_FAILED(_AnalyzeFontFallback(this, range));
}See #6695 for the introduction of text complexity analysis.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-RenderingText rendering, emoji, complex glyph & font-fallback issuesText rendering, emoji, complex glyph & font-fallback issuesIssue-TaskIt's a feature request, but it doesn't really need a major design.It's a feature request, but it doesn't really need a major design.Needs-Tag-FixDoesn't match tag requirementsDoesn't match tag requirementsProduct-ConhostFor issues in the Console codebaseFor issues in the Console codebaseProduct-TerminalThe new Windows Terminal.The new Windows Terminal.