Consider performing font fallback analysis only if the chosen font is not adequate #10858
Labels
Area-Performance
Performance-related issue
Area-Rendering
Text rendering, emoji, complex glyph & font-fallback issues
Issue-Task
It's a feature request, but it doesn't really need a major design.
Product-Terminal
The new Windows Terminal.
Milestone
Description of the new feature/enhancement
Right now the
_AnalyzeFontFallback
is always called if the text is "complex":terminal/src/renderer/dx/CustomTextLayout.cpp
Lines 246 to 247 in e710833
We already know that even for pure ASCII characters, some fonts will treat them as "complex". But the real need for font fallback emerges only when the font don't actually contains the needed glyph. For example when dealing with "ABC中文". You have to find "Microsoft YaHei" as fallback, otherwise "中文" is nowhere to be find in "Cascadia Code“.
Proposed technical implementation details (optional)
To avoid the unnecessary overhead of finding fallbacks (
MapCharacters
, which is relatively expensive), my proposed solution is to delay the fallback analysis and put it in_ShapeGlyphRun
. Inside_ShapeGlyphRun
, the methodGetGlyphs
will tell you precisely if there are available glyphs inside the desired font (_glyphIndices
):terminal/src/renderer/dx/CustomTextLayout.cpp
Line 414 in e710833
If no glyphs can be found (which I assume is a rather rare case), then the fallback analysis is necessary.
The text was updated successfully, but these errors were encountered: