[PR #13833] [MERGED] AtlasEngine: Round cell sizes to nearest instead of up #29776

Open
opened 2026-01-31 09:36:50 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/13833
Author: @lhecker
Created: 8/23/2022
Status: Merged
Merged: 8/24/2022
Merged by: @undefined

Base: mainHead: dev/lhecker/atlas-engine-cell-size


📝 Commits (1)

  • 3531cc0 AtlasEngine: Round cell sizes to nearest instead of up

📊 Changes

2 files changed (+10 additions, -9 deletions)

View changed files

📝 src/renderer/atlas/AtlasEngine.api.cpp (+8 -7)
📝 src/renderer/atlas/AtlasEngine.r.cpp (+2 -2)

📄 Description

After some deliberation I noticed that rounding the glyph advance up to yield
the cell width is at least just as wrong as rounding it. This is because
we draw glyphs centered, meaning that (at least in theory) anti-aliased
pixels might clip outside of the layout box on both sides of the glyph
adding not 1 but 2 extra pixels to the glyph size. Instead of just ceilf
we would have had to use ceilf(advanceWidth / 2) * 2 to account for that.

This commit simplifies our issue by just going with what other applications do:
Round all sizes (cell width and height) to the nearest pixel size.

Closes #13812

Validation Steps Performed

  • Set a breakpoint on scaling Required == true in AtlasEngine::_drawGlyph
  • Test an assortment of Cascadia Mono, Consolas, MS Gothic, Lucida Console
    at various font sizes (6, 7, 8, 10, 12, 24, ...)
  • Ensure breakpoint isn't hit
    This tells us that no glyph resizing was necessary

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/13833 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 8/23/2022 **Status:** ✅ Merged **Merged:** 8/24/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/atlas-engine-cell-size` --- ### 📝 Commits (1) - [`3531cc0`](https://github.com/microsoft/terminal/commit/3531cc0a5b881fa90c12b94d33fcbe14a64f6f38) AtlasEngine: Round cell sizes to nearest instead of up ### 📊 Changes **2 files changed** (+10 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `src/renderer/atlas/AtlasEngine.api.cpp` (+8 -7) 📝 `src/renderer/atlas/AtlasEngine.r.cpp` (+2 -2) </details> ### 📄 Description After some deliberation I noticed that rounding the glyph advance up to yield the cell width is at least just as wrong as rounding it. This is because we draw glyphs centered, meaning that (at least in theory) anti-aliased pixels might clip outside of the layout box on _both_ sides of the glyph adding not 1 but 2 extra pixels to the glyph size. Instead of just `ceilf` we would have had to use `ceilf(advanceWidth / 2) * 2` to account for that. This commit simplifies our issue by just going with what other applications do: Round all sizes (cell width and height) to the nearest pixel size. Closes #13812 ## Validation Steps Performed * Set a breakpoint on `scaling Required == true` in `AtlasEngine::_drawGlyph` * Test an assortment of Cascadia Mono, Consolas, MS Gothic, Lucida Console at various font sizes (6, 7, 8, 10, 12, 24, ...) * Ensure breakpoint isn't hit ✅ This tells us that no glyph resizing was necessary --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:36:50 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29776