Underline should be continuous across spacing from tracking#544
Underline should be continuous across spacing from tracking#544christianrondeau wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #544 +/- ##
=====================================
Coverage 84% 84%
=====================================
Files 332 332
Lines 24684 24683 -1
Branches 3612 3612
=====================================
+ Hits 20785 20807 +22
+ Misses 3011 2990 -21
+ Partials 888 886 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for the PR. I’m going to reject this one because my local branch already solves the same issue in a way that fits my newer rendering/decorations architecture better. The core idea is correct: decoration length should use the laid-out glyph advance, including tracking, so underlines/overlines/strikeouts remain continuous across tracking space. However, this PR is based on the older render path and passes a single-axis My local branch already passes the full layout advance as a |
|
Excellent, thanks! |
|
See above.
That new behaviour (enabled by default) will match chrome etc. I’ve got it working locally cannot release it without a matching Drawing release which I’m still working on. Not long though! Interestingly I actually found a bug in Chrome while implementing it. If you set the stroke width past a certain ratio to the font the underline is moved down from the baseline. |

Prerequisites
Description
Fixes SixLabors/ImageSharp.Drawing#405
The issue being that the underline (decoration) length did not take into account the actual advance, but instead only considered the font's advance.
Disclaimer: this code was written using AI (Copilot with Claude Opus 4.8), and reviewed by me.
Note that there is a big difference between Chrome's underline and ImageSharp's, but from my understanding, ImageSharp's the correct one because it's based on the post table metrics, and Chrome ignores it. This PR only solves the tracking issue and does not change the underline behavior in other ways.