Skip to content

Commit

Permalink
Merge pull request #1639 from contour-terminal/fix/undersoce_crop
Browse files Browse the repository at this point in the history
Do not crop symbol that is completely below cell
  • Loading branch information
Yaraslaut authored Oct 21, 2024
2 parents 2f529b3 + 2d74471 commit 3c2f95a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
<li>Add binding to exit normal mode with `Esc` (#1604)</li>
<li>Add config option to switch into insert mode after yank (#1604)</li>
<li>Improves window size/resize handling on HiDPI monitor settings (#1628)</li>
<li>Fixes cropping of underscore character for some fonts (#1603)</li>
</ul>
</description>
</release>
Expand Down
7 changes: 4 additions & 3 deletions src/vtrasterizer/TextRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,11 @@ auto TextRenderer::createRasterizedGlyph(atlas::TileLocation tileLocation,
// or 0 if not overflowing.
auto const yOverflow = max(0, yMax - _gridMetrics.cellSize.height.as<int>());

// {{{ crop underflow if yMin < 0
// {{{ crop underflow if yMin < 0 and yMax > 0
// If the rasterized glyph is underflowing below the grid cell's minimum (0),
// then cut off at grid cell's bottom.
if (yMin < 0)
// and overlaps with grid cell, then cut off at grid cell's bottom.
// For underscore glyphs, ymin can be lower than 0 but ymax is zero, so we need to check for yMax > 0.
if (yMin < 0 && yMax > 0)
{
auto const rowCount = (unsigned) -yMin;
Require(rowCount <= unbox(glyph.bitmapSize.height));
Expand Down

0 comments on commit 3c2f95a

Please sign in to comment.