-
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.
Put the final touches on GDI's underlines (#16475)
While #16444 left wavy lines in an amazing state already, there were a few more things that could be done to make GDI look more consistent with other well known Windows applications. But before that, a couple unrelated, but helpful changes were made: * `GdiEngine::UpdateFont` was heavily modified to do all calculations in floats. All modern CPUs have fast FPUs and even the fairly slow `lroundf` function is so fast (relatively) nowadays that in a cold path like this, we can liberally call it to convert back to `int`s. This makes intermediate calculation more accurate and consistent. * `GdiEngine::PaintBufferGridLines` was exception-unsafe due to its use of a `std::vector` with catch clause and this PR fixes that. Additionally, the vector was swapped out with a `til::small_vector` to reduce heap allocations. (Arena allocators!) * RenderingTests was updated to cover styled underlines With that in place, these improvements were done: * Word's double-underline algorithm was ported over from `AtlasEngine`. It uses a half underline-width (aka `thinLineWidth`) which will now also be used for wavy lines to make them look a bit more filigrane. * The Bézier curve for wavy/curly underlines was modified to use control points at (0.5,0.5) and (0.5,-0.5) respectively. This results in a maxima at y=0.1414 which is much closer to a sine curve with a maxima at 1/(2pi) = 0.1592. Previously, the maxima was a lot higher (roughly 4x) depending on the aspect ratio of the glyphs. * Wavy underlines don't depend on the aspect ratio of glyphs anymore. This previously led to several problems depending on the exact font. The old renderer would draw exactly 3 periods of the wave into each cell which would also ensure continuity between cells. Unfortunately, this meant that waves could look inconsistent. The new approach always uses the aforementioned sine-like waves. * The wavy underline offset was clamped so that it's never outside of bounds of a line. This avoids clipping. * Compile RenderingTests and run it * Using Consolas, MS Gothic and Cascadia Code while Ctrl+Scrolling up and down works as expected without clipping ✅ (cherry picked from commit 99193c9) Service-Card-Id: 91356394 Service-Version: 1.19
- Loading branch information
Showing
5 changed files
with
256 additions
and
159 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
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
Oops, something went wrong.
acb0630
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@check-spelling-bot Report
🔴 Please review
See the 📜action log for details.
Unrecognized words (11)
To accept ✔️ these unrecognized words as correct, run the following commands
... in a clone of the git@github.com:microsoft/terminal.git repository
on the
release-1.19
branch (ℹ️ how do I use this?):Pattern suggestions ✂️ (1)
You could add these patterns to .github/actions/spelling/patterns/acb06304c2002af43c321dd88fda3ae80c244c66.txt:
Warnings (1)
See the 📜action log for details.
See ℹ️ Event descriptions for more information.
✏️ Contributor please read this
By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
expect.txt
and theexcludes.txt
files.If the listed items are:
.github/actions/spelling/allow/names.txt
..github/actions/spelling/allow/
..github/actions/spelling/expect/
..github/actions/spelling/patterns/
.See the
README.md
in each directory for more information.🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉
If the flagged items are 🤯 false positives
If items relate to a ...
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txt
file matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^
refers to the file's path from the root of the repository, so^README\.md$
would exclude README.md (on whichever branch you're using).well-formed pattern.
If you can write a pattern that would match it,
try adding it to the
patterns.txt
file.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.