Skip to content

Improve cubic bezier curves approximation with quadratic beziers #25

@puzrin

Description

@puzrin

Current cubic2quad convert algorythm is very basic. That does not affect original fonts, but can cause issues, when originals are drawn in SVG. We use stupid midpoint approach with 2 quad curves. It sucks, because we need to keep tangents on edge points.

  1. Approaches:
  2. Error metrict calculation:

Example to reproduce problem (from octicons font):

<svg height="1024" width="1024" xmlns="http://www.w3.org/2000/svg">
  <path d="M768 768H576c0 0-254.281 0-256-256 0-22.281 3.469-43.469 8.312-64h137.405c-11 18.875-17.719 40.562-17.719 64 0 128 128 128 128 128h192c0 0 128 0 128-128S768 384 768 384s-0.125-64-64-128h64c0 0 256 0 256 256S768 768 768 768zM695.688 576H558.25c11-18.875 17.75-40.562 17.75-64 0-128-128-128-128-128H256c0 0-128 0-128 128s128 128 128 128-3.906 64.875 65.719 128H256c0 0-256 0-256-256s256-256 256-256h192c0 0 256 0 256 256C704 534.281 700.5 555.5 695.688 576z" />
</svg>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions