[PR #13549] [MERGED] AtlasEngine: Scale glyphs to better fit the cell size #29616

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/13549
Author: @lhecker
Created: 7/20/2022
Status: ✅ Merged
Merged: 8/1/2022
Merged by: @undefined

Base: main ← Head: dev/lhecker/glyph-sizing


📝 Commits (3)

  • 2cd9523 AtlasEngine: Scale glyphs to better fit the cell size
  • c20e0a0 Address feedback, Fix issues
  • dfa9255 Add comment, Fix centering

📊 Changes

7 files changed (+473 additions, -148 deletions)

View changed files

📝 src/renderer/atlas/AtlasEngine.api.cpp (+1 -0)
📝 src/renderer/atlas/AtlasEngine.cpp (+13 -136)
📝 src/renderer/atlas/AtlasEngine.h (+7 -1)
📝 src/renderer/atlas/AtlasEngine.r.cpp (+212 -11)
➕ src/renderer/atlas/DWriteTextAnalysis.cpp (+172 -0)
➕ src/renderer/atlas/DWriteTextAnalysis.h (+66 -0)
📝 src/renderer/atlas/atlas.vcxproj (+2 -0)

📄 Description

This commit contains 3 improvements for glyph rendering:

  • Scale block element and box drawing characters to fit the cell size
    "perfectly" without leaving pixel gaps between cells.
  • Use IDWriteTextLayout::GetOverhangMetrics to determine whether glyphs
    are outside the given layout box and if they are, offset their position
    to fit them back in. If that still fails to fit, we downscale them.
  • Always scale up glyphs that are more than 2 cells wide
    This ensures that long ligatures that mimic box drawing characters like
    "===" under Cascadia Code are upscaled just like regular box drawings.
    Unfortunately this results in ligature-heavy text (like Myanmar) to get an
    "uneven" appearance because some ligatures can suddenly appear too large.
    It's difficult to come up with a good heuristic here.

Closes #12512

Validation Steps Performed

  • Print UTF-8-demo.txt
  • Block characters don't leave gaps ✅
  • Print a lorem-ipsum in Myanmar
  • Glyphs aren't cut off anymore ✅
  • Print a long "===" ligature under Cascadia Code
  • The ligature is as wide as the number of cells used ✅

🔄 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/13549 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 7/20/2022 **Status:** ✅ Merged **Merged:** 8/1/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/glyph-sizing` --- ### 📝 Commits (3) - [`2cd9523`](https://github.com/microsoft/terminal/commit/2cd9523f047c04384d8f62e6dae19c7080eea9ff) AtlasEngine: Scale glyphs to better fit the cell size - [`c20e0a0`](https://github.com/microsoft/terminal/commit/c20e0a007a99cef02ef7892c65fc013222fa6ad1) Address feedback, Fix issues - [`dfa9255`](https://github.com/microsoft/terminal/commit/dfa92559611f5c982f78cba73d123638a5e54227) Add comment, Fix centering ### 📊 Changes **7 files changed** (+473 additions, -148 deletions) <details> <summary>View changed files</summary> 📝 `src/renderer/atlas/AtlasEngine.api.cpp` (+1 -0) 📝 `src/renderer/atlas/AtlasEngine.cpp` (+13 -136) 📝 `src/renderer/atlas/AtlasEngine.h` (+7 -1) 📝 `src/renderer/atlas/AtlasEngine.r.cpp` (+212 -11) ➕ `src/renderer/atlas/DWriteTextAnalysis.cpp` (+172 -0) ➕ `src/renderer/atlas/DWriteTextAnalysis.h` (+66 -0) 📝 `src/renderer/atlas/atlas.vcxproj` (+2 -0) </details> ### 📄 Description This commit contains 3 improvements for glyph rendering: * Scale block element and box drawing characters to fit the cell size "perfectly" without leaving pixel gaps between cells. * Use `IDWriteTextLayout::GetOverhangMetrics` to determine whether glyphs are outside the given layout box and if they are, offset their position to fit them back in. If that still fails to fit, we downscale them. * Always scale up glyphs that are more than 2 cells wide This ensures that long ligatures that mimic box drawing characters like "===" under Cascadia Code are upscaled just like regular box drawings. Unfortunately this results in ligature-heavy text (like Myanmar) to get an "uneven" appearance because some ligatures can suddenly appear too large. It's difficult to come up with a good heuristic here. Closes #12512 ## Validation Steps Performed * Print UTF-8-demo.txt * Block characters don't leave gaps ✅ * Print a lorem-ipsum in Myanmar * Glyphs aren't cut off anymore ✅ * Print a long "===" ligature under Cascadia Code * The ligature is as wide as the number of cells used ✅ --- <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:35:56 +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#29616