-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Reintroduce simple text analysis escape without crash or box drawing issue #6668
Description
Notes from bugs:
From #6488
When I run this in PowerShell (7),
"`e[30;47m`u{2500} What `u{2500}`e[m"the text comes out without antialiasing. It looks like it's being drawn with FillGeometry just like a box drawing glyph.
If I flip the colors, it comes out antialiased.
Okay, this is because we're not populating
_glyphClusterswhen text is "simple". When we go to split the run later (we split runs for things other than text analysis!), we try to remap the glyph clusters around the split.Inevitably, we end up falling into DrawGlyphRun with
run.glyphCount= 0 because_SplitCurrentRunstomped the glyphCount because there was no glyph cluster mapping.Somehow magically we end up doing a "get raw geometry, draw" for the entire string which very handily hides the glyph clustering bug!
This fix works but I do not believe it is correct:
diff --git a/src/renderer/dx/CustomTextLayout.cpp b/src/renderer/dx/CustomTextLayout.cpp index d19d2d0c3..395a58224 100644 --- a/src/renderer/dx/CustomTextLayout.cpp +++ b/src/renderer/dx/CustomTextLayout.cpp @@ -336,6 +336,7 @@ CustomTextLayout::CustomTextLayout(gsl::not_null<IDWriteFactory1*> const factory for (size_t i = glyphStart; i < _glyphAdvances.size(); i++) { _glyphAdvances.at(i) = (float)_glyphDesignUnitAdvances.at(i) / designUnitsPerEm * _format->GetFontSize() * run.fontScale; + _glyphClusters.at(i) = static_cast<UINT16>(i); } run.glyphCount = textLength;I'm worried about that "magical" rendering fallthrough. With this fix, are we striking the text twice -- once as a geometry and once as a glyph run?
(I commented out the glyph run drawing, and I think the answer is no.)
From #6664
Terminal crashed. In debug configuration raised exception in "vector" include file in
function void _Verify_offset(const difference_type _Off) const at line 113
"cannot seek vector iterator after end"Call stack:
...
problem at
src\renderer\dx\CustomTextLayout.cpp at line 867:
const auto postOriginX = std::accumulate(_glyphAdvances.begin() + run.glyphStart,
_glyphAdvances.begin() + run.glyphStart + run.glyphCount,
mutableOrigin.x);_glyphAdvances.size(): 0x000000000000001f
run.glyphStart: 0x00000001
run.glyphCount: 0x0000ffffSame problem in wsl2 (Ubuntu or CentOS not matter) with Midnight Commander... start ok (in user's home directory) but Terminal crashes when trying cd to /home directory with mouse double click under .. or with cd .. in command line.
@igorkuzuro

