Assertion Failure calculating glyph spacing with certain UTF-8 chars #778

Closed
opened 2026-01-30 22:03:53 +00:00 by claunia · 2 comments
Owner

Originally created by @oising on GitHub (May 7, 2019).

Originally assigned to: @miniksa on GitHub.

  • Your Windows build number: (Type ver at a Windows Command Prompt)

10.0.18362.53

  • What you're doing and what's happening: (Copy & paste specific commands and their output, or include screen shots)

Attempting to display the contents of an UTF-8 encoded text file, and an assertion failure occurs in std::vector, in turn caused by an array index out of bounds exception in CustomTextLayout.cpp with _textClusterColumns:

   for (auto i = run.glyphStart; i < (run.glyphStart + run.glyphCount); i++)
        {
            // Advance is how wide in pixels the glyph is
            auto& advance = _glyphAdvances[i];

            // Offsets is how far to move the origin (in pixels) from where it is
            auto& offset = _glyphOffsets[i];

            // Get how many columns we expected the glyph to have and mutiply into pixels.
            const auto columns = _textClusterColumns[i];    // <<< HERE
  • What's wrong / what should be happening instead:

it shud wurkkk.

I've attached the UTF-8 "torture test" text file that triggers the exception. I'm guessing this could be useful to integrate into your CI. Don't forget to chcp 65001 before cat'ing it in cmd ;)

UTF-8-demo.txt

Originally created by @oising on GitHub (May 7, 2019). Originally assigned to: @miniksa on GitHub. * Your Windows build number: (Type `ver` at a Windows Command Prompt) 10.0.18362.53 * What you're doing and what's happening: (Copy & paste specific commands and their output, or include screen shots) Attempting to display the contents of an UTF-8 encoded text file, and an assertion failure occurs in `std::vector`, in turn caused by an array index out of bounds exception in `CustomTextLayout.cpp` with `_textClusterColumns`: ```cpp for (auto i = run.glyphStart; i < (run.glyphStart + run.glyphCount); i++) { // Advance is how wide in pixels the glyph is auto& advance = _glyphAdvances[i]; // Offsets is how far to move the origin (in pixels) from where it is auto& offset = _glyphOffsets[i]; // Get how many columns we expected the glyph to have and mutiply into pixels. const auto columns = _textClusterColumns[i]; // <<< HERE ``` * What's wrong / what should be happening instead: it shud wurkkk. I've attached the UTF-8 "torture test" text file that triggers the exception. I'm guessing this could be useful to integrate into your CI. Don't forget to `chcp 65001` before `cat`'ing it in cmd ;) [UTF-8-demo.txt](https://github.com/microsoft/Terminal/files/3153810/UTF-8-demo.txt)
claunia added the Resolution-Fix-AvailableArea-RenderingIssue-BugProduct-Terminal labels 2026-01-30 22:03:53 +00:00
Author
Owner

@krokofant commented on GitHub (Aug 8, 2019):

I'm wondering if this is what I'm experiencing. When I first installed the Terminal it looked okay without the extra spacing but now the glyphs have more space than usual.

Windows Terminal
image

PowerShell Core
image

@krokofant commented on GitHub (Aug 8, 2019): I'm wondering if this is what I'm experiencing. When I first installed the Terminal it looked okay without the extra spacing but now the glyphs have more space than usual. **Windows Terminal** ![image](https://user-images.githubusercontent.com/5908498/62689315-dfc0d600-b9ca-11e9-8d94-517c8280260a.png) **PowerShell Core** ![image](https://user-images.githubusercontent.com/5908498/62690526-1ef02680-b9cd-11e9-82c0-4af9638746db.png)
Author
Owner

@zadjii-msft commented on GitHub (Jan 22, 2020):

Hey so this crash is gone in 0.8. I bet it was fixed even longer ago, but ain't nobody got time for bisecting. Sure, the alignment problems are still there occasionally, but I believe that's tracked by other issues. I'm gonna close this for now. Thanks!

@zadjii-msft commented on GitHub (Jan 22, 2020): Hey so this crash is gone in 0.8. I bet it was fixed even longer ago, but _ain't nobody got time for bisecting_. Sure, the alignment problems are still there occasionally, but I believe that's tracked by other issues. I'm gonna close this for now. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#778