Class: Fontisan::SvgToGlyf::Path::ContourBuilder
- Inherits:
-
Object
- Object
- Fontisan::SvgToGlyf::Path::ContourBuilder
- Defined in:
- lib/fontisan/svg_to_glyf/path/contour_builder.rb
Overview
Converts an array of Path::Command objects into an array of Fontisan::Ufo::Contour objects.
Tracks current-point, subpath-start, and previous-control-point state to resolve relative coordinates and smooth-curve reflections.
Point type mapping (Ufo::Point types):
M (first in subpath) → first point of contour, type "line"
L / H / V → "line"
C → "offcurve", "offcurve", "curve"
S → reflected "offcurve", "offcurve", "curve"
Q → "offcurve", "qcurve"
T → reflected "offcurve", "qcurve"
Z → closes the contour (no point emitted)
Instance Method Summary collapse
Instance Method Details
#build(commands) ⇒ Array<Fontisan::Ufo::Contour>
23 24 25 26 27 28 |
# File 'lib/fontisan/svg_to_glyf/path/contour_builder.rb', line 23 def build(commands) state = State.new commands.each { |cmd| apply(cmd, state) } state.finalize_contour state.contours end |