Skip to content

Fix computing winding in embolden - #135

Open
rhysd wants to merge 1 commit into
dfrg:mainfrom
rhysd:fix-empolden-winding
Open

Fix computing winding in embolden#135
rhysd wants to merge 1 commit into
dfrg:mainfrom
rhysd:fix-empolden-winding

Conversation

@rhysd

@rhysd rhysd commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fix #134

LayerMut::embolden computed the winding from all points in a layer as one polygon. With disconnected contours, this adds nonexistent edges between contours to the area calculation and can reverse the winding. As a result, synthetic bold could shrink some glyphs, such as Monaco's i reported in #134.

This change computes the area for each contour separately and sums the results before determining the winding. Then the resulting global winding is used for all contours preserving the correct behavior for inner counter contours.

I verified this change with Monaco text on my app as follows. The existing tests and doc tests pass.

  • Non-bold text
Image
  • Bold text before this fix
Image
  • Bold text after this fix
image

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.

embolden fails at 'i' glyph of Monaco font

1 participant