Skip to content

Use active font metrics for grid line rendering #6911

@j4james

Description

@j4james

Description of the new feature/enhancement

I was looking at adding support for the crossed-out attribute, but found that it doesn't look very good without getting the font metrics to draw the line in the right position, and ideally the right size. And I know there have also been discussions before about the need to draw the underline in the right position and size.

So as a first step, I thought it might be good idea to put together a PR just gathering the font line metrics, and updating the grid line code to take those metrics into account. This is not about drawing the underline in the right position yet - just getting the existing grid lines to scale with the font size.

Proposed technical implementation details (optional)

My first thought was to use the underline thickness metric for the width of all grid lines, and you can see an example of what that might look like below:

image

But based on those results, I'm now more inclined to think a hard coded size might be preferable. Either option would be better than the current single pixel width, though, which is almost invisible on high dpi displays. If we do go with a hard coded value, I think something around the thickness of Cascadia or Fira Code would be reasonable (that's about 0.025em).

And while looking at this area of the code, I also wanted to propose some refactoring of the grid line renderer to be more efficient. In the current implementation, if you're drawing an underline across 20 cells, it actually renders it with 20 separate strokes, when it could easily be done in one. The left and right grid lines still need to be rendered one cell at a time, but that's a much less common occurrence.

So just to summarize:

  1. Is is OK if I do a PR to make the grid lines scale with the font size?
  2. If so, should I use the font's underline thickness or a fixed em size?
  3. Can I do a refactor/optimisation of the rendering code at the same time?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-RenderingText rendering, emoji, complex glyph & font-fallback issuesHelp WantedWe encourage anyone to jump in on these.Issue-TaskIt's a feature request, but it doesn't really need a major design.Product-ConhostFor issues in the Console codebaseProduct-TerminalThe new Windows Terminal.Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions