Skip to content

Overlap detection & removal primitives - #2070

Open
RickyDaMa wants to merge 6 commits into
googlefonts:mainfrom
daltonmaag:overlap-primitives
Open

Overlap detection & removal primitives#2070
RickyDaMa wants to merge 6 commits into
googlefonts:mainfrom
daltonmaag:overlap-primitives

Conversation

@RickyDaMa

@RickyDaMa RickyDaMa commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

This PR adds functions to concatenate BezPaths, as well as functions that use linesweeper to perform overlap removal & detection. In future PRs these can then be used to do overlap removal for statics (#717) and automatically set the overlap bit (#2061).

Outstanding questions:

  1. Do we want to expose linesweeper types internally within the fontc crates? Currently linesweeper::Error is exposed.
  2. Do we need to specify an epsilon value ourselves? linesweeper uses 1e-6 by default.
  3. Is this code living in the right place? I can foresee fontir needing the overlap removal method and fontbe needing overlap detection, so my rationale was that the logic should go in the "general utilities & types" crate.
  4. What sort of QA do we want around this code to be satisfied that it's doing the right thing? Tests are pretty minimal right now while this is a proof of concept, but when it comes to actually setting the overlap bit and such we probably want to be a lot more rigorous

For the TODOs in code that talk about potential linesweeper features, I have opened an issue and a PR.

@rsheeter
rsheeter requested a review from anthrotype July 28, 2026 16:32
@rsheeter rsheeter added the enhancement New feature or request label Jul 28, 2026
Comment thread fontdrasil/src/overlaps.rs Outdated
let has_overlaps = non_zero_beziers
.contours()
.zip(even_odd_beziers.contours())
.all(|(non_zero_contour, even_odd_contour)| non_zero_contour.path == even_odd_contour.path);

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.

Wait, shouldn't the logic be flipped here?

-        .all(|(non_zero_contour, even_odd_contour)| non_zero_contour.path == even_odd_contour.path);
+        .any(|(non_zero_contour, even_odd_contour)| non_zero_contour.path != even_odd_contour.path);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Shoot sorry, forgot to push my latest before opening the PR 🙈 This expression ended up getting refactored, but should be semantically correct now

@RickyDaMa
RickyDaMa force-pushed the overlap-primitives branch from 5d287c0 to be7ee00 Compare July 29, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants