Skip to content

Faux bold when the font does not support it#543

Merged
JimBobSquarePants merged 2 commits into
SixLabors:mainfrom
christianrondeau:faux-bold
Jul 10, 2026
Merged

Faux bold when the font does not support it#543
JimBobSquarePants merged 2 commits into
SixLabors:mainfrom
christianrondeau:faux-bold

Conversation

@christianrondeau

Copy link
Copy Markdown
Contributor

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

A follow-up to #542 - should be merged after the italic one.

Bold is much more complex than italic, because it requires dilating glyphs, although it does not require changing the advance (I thought it would require it but comparing to Chrome, it looks fine with just widening the glyphs).

Disclaimer: this code was written using AI (Copilot with Claude Opus 4.8), and reviewed by me. However, while the italic PR is fairly simple to understand, I don't have the knowledge to personally fully verify EmboldeningGlyphRenderer. This being said, the logic looks sound and renders correctly.

image

Thanks for your consideration!

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.69421% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 84%. Comparing base (38b3e5a) to head (6e54360).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...Labors.Fonts/Rendering/EmboldeningGlyphRenderer.cs 95% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##            main    #543    +/-   ##
======================================
  Coverage     84%     84%            
======================================
  Files        332     333     +1     
  Lines      24708   24815   +107     
  Branches    3618    3640    +22     
======================================
+ Hits       20813   20917   +104     
  Misses      3009    3009            
- Partials     886     889     +3     
Flag Coverage Δ
unittests 84% <96%> (+<1%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@JimBobSquarePants JimBobSquarePants left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. I’m going to accept this PR as an initial integration point, but with some important caveats.

Synthetic bold should be owned by Fonts so that all renderers receive the same glyph geometry. However, the current emboldening implementation should not be treated as final. I want to follow browser layout behavior, meaning synthetic bold should not change layout advance, but I also want the actual outline dilation logic to be much closer to FreeType’s outline emboldening algorithm.

So I’m going to merge this to unblock the feature, then follow up by replacing/refining the dilation algorithm and adding stronger tests around counters, mixed contour winding, CFF/TrueType outlines, and bounds behavior.

@JimBobSquarePants JimBobSquarePants merged commit 98aeb3f into SixLabors:main Jul 10, 2026
8 checks passed
@christianrondeau

Copy link
Copy Markdown
Contributor Author

Thank you; let me know if you'd like me to spend more time on any of it!

@christianrondeau christianrondeau deleted the faux-bold branch July 10, 2026 15:52
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