Skip to content

Investigate alternative ways to handle box drawing/block elements #5897

Closed

Description

There've been some concerns about how we scale glyphs in the Box Drawing character block.

Other terminal emulators do interesting things:

  • Gnome-terminal uses little 5x5 bitmaps and stretches them to fill the entire cell (shout-out to Egmont Koblinger (@egmontkob) for telling me this!)
    • This results in pixel perfect lines and shading.
  • [Other popular terminal] uses line-drawing primitives at the graphics layer to mimic box drawing and rect-filling primitives with opacity to mimic block elements
    • This also results in pixel-perfect lines and cool blended shading glyphs.

We chose not to do these things for v1.0 because we learned that certain fonts (monofur is a good one) have their own unique styles for box drawing and block elements that we wanted to preserve.

Proposed solution

  • Add a setting for "Let Windows Terminal handle block / powerline drawing"
    • This is a per-profile setting. profile::compatibility.builtinBlockDrawing
    • When enabled, Terminal will manually draw box-drawing and powerline glyphs, replacing the glyph from the font
    • Enable this by default
      • Obviously, users will be able to opt out
      • This will give us the benefit of getting PL glyphs even for fonts without them!
    • We should probably start with a few of the glyphs as higher pri:
      image
      • Green: Definitely, in v0
      • Yellow: okay probably yea
      • Orange: meh
      • red: probably too expensive (engineering wise)
      • white: I can't imagine we'll actually need to draw these
  • Add a secondary setting for "Replace filled rectangles with transparent glyphs"
    • Only enable if compatibility.builtinBlockDrawing is enabled

Links

Activity

  1. added
    Help Wanted
    Area-Rendering
    Product-Terminal
    Issue-Task
    on May 13, 2020
  2. ghost added
    Needs-Triage
    on May 13, 2020
  3. changed the title [-]Investigate alternative ways to handle box/line drawing[/-] [+]Investigate alternative ways to handle box drawing/block elements[/+] on May 13, 2020
  4. removed
    Needs-Triage
    on May 13, 2020
  5. benc-uk commented on May 14, 2020

    @benc-uk

    The shaded/hatched boxes now look really bad since the last update.
    A lot of themes like Powerlevel10k use these

    This is my prompt now in Windows Terminal
    image

    This is what it should look like (In VS Code)
    image

  6. DHowett-MSFT commented on May 14, 2020

    @DHowett-MSFT
    ContributorAuthor

    yikes.

  7. DHowett-MSFT commented on May 14, 2020

    @DHowett-MSFT
    ContributorAuthor

    Though, that looks like Cascadia Code. The version released yesterday with the new metrics works properly with Terminal. You may need to update.

  8. benc-uk commented on May 14, 2020

    @benc-uk

    Hi, I just updated to CascadiaCode_2004.30, and I didn't see any difference :(
    image

    Weirdly if I set my font size to 15, the shading disappears altogether, and at font size 19 it looks perfect, but that's just too huge to use!

  9. benc-uk commented on May 14, 2020

    @benc-uk

    Some further tests with Cascadia Code.

    At font size 14 the line elements are super thin and the curved corner lacks any antialiasing/smoothing
    image

    At font size 13 they look much better
    image

  10. mdtauk commented on May 14, 2020

    @mdtauk

    I think if this is added, it should be behind a setting. Something like

    ☑ Let Windows Terminal handle block character drawing

    Cascadia code has an interesting approach to the character of some of it's Block Characters, and other fonts will also. That character is lost by Terminal doing it itself - so it should be optional IMO

  11. ionut-botizan commented on May 19, 2020

    @ionut-botizan

    I'd really love to see those "rect-filling primitives with opacity" make it into the Windows Terminal:

    1. top left - Windows Terminal with Fira Code 12px
    2. bottom left - Windows Terminal with Fira Code 15 px
    3. top right - [Other popular terminal] with Fira Code 12px

    (the filling char I'm using is $([char]0x2592) or "░")

    image

    Obviously, the best looking one is the one on the right and the second best one is the one with the 15px font size. Sadly, 15px is way too big, so I'm stuck with the ugly looking one for now. 🙂

  12. 30 remaining items

  13. he3als commented on Jun 15, 2022

    @he3als

    Are there any ways to fix this issue at the moment? I am using the default font.

  14. jaminthorns commented on Feb 3, 2023

    @jaminthorns

    I'd really love to see this implemented as it can provide a much nicer TUI experience. If this ends up happening, it'd be great if the Powerline symbols were implemented as well (don't forget the slants/triangles!).

    Here's some further reading for anyone interested in how some other terminals handle rendering of box drawing characters:

  15. ShelpAm commented on Dec 4, 2023

    @ShelpAm
  16. Mystic8b commented on Feb 6, 2024

    @Mystic8b

    Well, #16664 was closed, so I'm writing here.
    I and tens of thousands of other people use zsh + p10k. And AtlasEngine breaks the prompt in p10k by cutting off the bottom pixel or something like that. In the last release you enabled Atlas by default, which means you are sure there are no problems, but this is not the case! This is a huge problem. Pay attention to this. Thank you!

    Old engine:
    image

    New engine:
    image

    And no, it's not a font problem, I've tried every variation of Nerd Fonts. I asked the developer of p10k, he also said that it was a terminal problem.


    • Terminal ver: 1.19.10302.0
    • ZSH
    • p10k (rainbow theme)
    • MesloLGS Nerd Font (from p10k repo)
    • 9pt font size
    • 100% scale screen (1080p 2560x1080)
  17. zadjii-msft commented on Feb 6, 2024

    @zadjii-msft
    Member

    To loop back on this: I've updated the OP with our plan-of-record. Adding a setting to force Terminal to draw pixel-perfect glyphs seems like the right plan. It'll be a setting, so users can always feel free to opt-out if they want the glyph from their font instead.

    Adding the setting itself is trivial.
    Figuring out how to get the renderer to draw each of those shapes: that's a little more work. Hence why we've tried to group them by priority.

    We'd probably appreciate help here, if someone's willing to figure out the glyph drawing 😉

  18. lhecker commented on Feb 16, 2024

    @lhecker
    Member

    Box drawing and block element glyphs are done:
    image

    Powerline glyphs are much more difficult to do, because a user's font may not have powerline glyphs in the first place and so there's nothing to MapCharacters to. This made me realize that I need to do my own MapCharacters in addition to what DWrite is doing and that will take some time because it requires additional work on the text renderer - work that isn't trivial unfortunately since DWrite is a little unwieldy.

  19. added
    In-PR
    on Feb 17, 2024
  20. added a commit that references this issue on Feb 23, 2024
    a6a0e44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area-RenderingHelp WantedIn-PRIssue-FeatureNeeds-Tag-FixPriority-1Product-Terminal

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions