-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Description
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
| // Perform our custom font fallback analyzer that mimics the pattern of the real analyzers. | |
| RETURN_IF_FAILED(_AnalyzeFontFallback(this, 0, textLength)); |
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 method GetGlyphs will tell you precisely if there are available glyphs inside the desired font (_glyphIndices):
terminal/src/renderer/dx/CustomTextLayout.cpp
Line 414 in e710833
| hr = _fontRenderData->Analyzer()->GetGlyphs( |
If no glyphs can be found (which I assume is a rather rare case), then the fallback analysis is necessary.