Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not crop symbol that is completely below cell #1639

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading