Class: Fontisan::SvgToGlyf::Path::ContourBuilder

Inherits:
Object
  • Object
show all
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) 

Instance Method Summary collapse

Instance Method Details

#build(commands) ⇒ Array<Fontisan::Ufo::Contour>

Parameters:

Returns:



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