Skip to content

Conversation

@Socolin
Copy link
Contributor

@Socolin Socolin commented Dec 18, 2025

Introduces a Tracking property to TextOptions to allow uniform adjustment of spacing between characters, measured in em units.

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

I'm not sure:

  • If the unit, if it should be in em or milliem of em or something else.
  • If the name of the feature, if it should be Tracking or a more user friendly like in css LetterSpacing ?
  • If this need more tests, since the rendering is in ImageSharp.Drawing I don't know if I should add some test comparing images instead of just checking values

I did some simple render test and it seems to works and give the same result as Chrome

Top: Chrome
Below: ImageSharp

image

@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83%. Comparing base (bc2501d) to head (96e500f).
⚠️ Report is 75 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #492     +/-   ##
=======================================
- Coverage     87%     83%     -4%     
=======================================
  Files        238     272     +34     
  Lines      15457   18930   +3473     
  Branches    2187    2676    +489     
=======================================
+ Hits       13452   15837   +2385     
- Misses      1538    2422    +884     
- Partials     467     671    +204     
Flag Coverage Δ
unittests 83% <100%> (-4%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Introduces a Tracking property to TextOptions to allow uniform
adjustment of spacing between characters, measured in em units.
@Socolin
Copy link
Contributor Author

Socolin commented Dec 19, 2025

The new code still have a bug.

\u0930\u094D\u0915\u093F is printing with tracking = 1
2

And with tracking = 0 (Correct)
2

Do you have an idea of what is the problem with this one ?

It's one of the unit test in this PR

@JimBobSquarePants
Copy link
Member

The new code still have a bug.

\u0930\u094D\u0915\u093F is printing with tracking = 1 2

And with tracking = 0 (Correct) 2

Do you have an idea of what is the problem with this one ?

It's one of the unit test in this PR

I think so. We should be checking the grapheme index I think.

@Socolin
Copy link
Contributor Author

Socolin commented Dec 19, 2025

The graphemeIndex and graphemeCodePointIndex values are [0,0,1] I'm not sure we can do much with it or if there is a problem elsewhere because I found a bug with this character too when rendering it in Vertical mode:

2

So maybe fixing it in vertical mode will fix for this scenario too ? I have no idea how to investigate the problem here, do you want me to open another issue for this ?

@JimBobSquarePants
Copy link
Member

@Socolin I'll need to pull down your fork to fix the PR as the fix is quite complex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants