Skip to content

Commit

Permalink
Merge pull request #1716 from contour-terminal/fix/hard_underflow_fon…
Browse files Browse the repository at this point in the history
…t_crop
  • Loading branch information
Yaraslaut authored Jan 31, 2025
2 parents 8ce6b81 + 1d3657d commit fdf03a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 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>Fixes `CreateTab` to sometimes spawn more than one tab (#1695)</li>
<li>Fixes crash using Chinese IME (#1707)</li>
<li>Ensure inserting new tabs happens right next to the currently active tab (#1695)</li>
<li>Allow glyphs to underflow if they are not bigger than the cell size (#1603)</li>
<li>Adds `MoveTabToLeft` and `MoveTabToRight` actions to move tabs around (#1695)</li>
<li>Adds `MoveTabTo` action to move tabs to a specific position (#1695)</li>
<li>Adds handling of control codes for Ctrl+5|6|7|8 (#1701)</li>
Expand Down
7 changes: 2 additions & 5 deletions src/vtrasterizer/TextRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,11 +770,8 @@ 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 and yMax > 0
// If the rasterized glyph is underflowing below the grid cell's minimum (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)
// {{{ crop underflow if glyph is larger than cell
if (yMax - yMin > _gridMetrics.cellSize.height.as<int>())
{
auto const rowCount = (unsigned) -yMin;
Require(rowCount <= unbox(glyph.bitmapSize.height));
Expand Down

0 comments on commit fdf03a3

Please sign in to comment.