-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AtlasEngine: Round cell sizes to nearest instead of up (#13833)
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
- Loading branch information
Showing
2 changed files
with
10 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters