Skip to content

refactor(curves)!: replace flo-curves with kurbo - #202

Draft
rami3l with Copilot wants to merge 2 commits into
masterfrom
copilot/migrate-monoxide-curves-to-kurbo
Draft

refactor(curves)!: replace flo-curves with kurbo#202
rami3l with Copilot wants to merge 2 commits into
masterfrom
copilot/migrate-monoxide-curves-to-kurbo

Conversation

Copilot AI commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Related to #203.

monoxide-curves previously re-implemented flo_curves' generic point/curve traits by hand. This replaces that layer with kurbo, keeping only the custom stroked-with-alignment logic that kurbo doesn't provide.

Core types now wrap kurbo directly

  • Point2D = re-export of kurbo::Point; Affine2D = re-export of kurbo::Affine.
  • Missing helpers (unit_x, translated, mirrored_along, flips_direction, etc.) added via Point2DExt/AffineExt extension traits instead of a full custom type.
  • CubicSegment/CubicBezier/builder/iterator rewritten as concrete (non-generic) types backed by kurbo::CubicBez/Line/PathSeg, dropping the generic Point/Num trait scaffolding.

Dropped hand-rolled algorithms in favor of kurbo

  • cube_to_quad now delegates to kurbo::CubicBez::to_quads, removing ~250 lines of custom FontForge/naive conversion code.
  • Arc length now uses kurbo::ParamCurveArclen::arclen instead of a custom flo_curves-based implementation.
  • cube/compat.rs and other pure flo_curves compatibility scaffolding removed.

Stroked-with-alignment logic preserved

  • Tangent/normal/join computation for per-point variable-width, aligned stroking (used in glyph generation) is unchanged in behavior, just retyped from custom vector math to kurbo::Vec2.
// Before: generic type implementing flo_curves' Coordinate/Geo traits
let bez: CubicBezier<Point2D> = ...;

// After: concrete type built directly on kurbo
let bez: CubicBezier = ...;
let quads = cube_to_quad(bez, accuracy); // delegates to kurbo::CubicBez::to_quads

Consumer crates (monoxide-script, monoxide-font, monoxide-playground) were updated to drop the now-unnecessary generic parameters and pull in the new extension traits where needed. monoxide-ttf is unaffected, since its QuadBezier<(fword, fword)> usage relies on QuadBezier remaining generic, which is retained.

@rami3l
rami3l force-pushed the copilot/migrate-monoxide-curves-to-kurbo branch 2 times, most recently from 15d3c31 to a978dfe Compare August 1, 2026 18:56

/// A quadratic bezier segment, with `P` as the point type
#[derive(Debug, Clone, PartialEq)]
pub struct QuadSegment<P> {

@rami3l rami3l Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not sure if it's still worth it to keep CubeSegment generic. It looks like QuadSegment is actually generic in the codebase but not for CubeSegment. Maybe a default generic param =Point2D can be used?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm, I'll try to let my agent add a =point2d

@rami3l rami3l Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@lynzrand BTW do you think CubeSegment needs to be generic? Because our agent decided that it's actually always materialized with Point2D and has thus removed that param.

@rami3l
rami3l force-pushed the copilot/migrate-monoxide-curves-to-kurbo branch from a978dfe to e4594e9 Compare August 1, 2026 19:17
@rami3l rami3l changed the title Migrate monoxide-curves to a thin kurbo wrapper refactor(curves)!: replace flo-curves with kurbo Aug 1, 2026
Co-authored-by: rami3l <rami3l@outlook.com>
@rami3l
rami3l force-pushed the copilot/migrate-monoxide-curves-to-kurbo branch from e4594e9 to 496d58e Compare August 1, 2026 19:18
@rami3l
rami3l requested a review from lynzrand August 1, 2026 19:34

@lynzrand lynzrand left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

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.

3 participants