Class: Fontisan::StitcherCli
- Inherits:
-
Thor
- Object
- Thor
- Fontisan::StitcherCli
- Defined in:
- lib/fontisan/stitcher_cli.rb
Overview
CLI subcommand for multi-source font stitching.
fontisan stitch --source latin=PATH --source jp=PATH \
--output out.ttf \
--include-range latin=0x41-0x5A \
--include-range jp=0x3040-0x309F
Instance Method Summary collapse
Instance Method Details
#stitch ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fontisan/stitcher_cli.rb', line 27 def stitch stitcher = Stitcher.new [:source].each do |spec| label, path = spec.split("=", 2) font = load_source(path) stitcher.add_source(label, font) end [:include_range]&.each do |spec| label, range_str = spec.split("=", 2) lo, hi = parse_range(range_str) stitcher.include_range(lo..hi, from: label) end [:include_codepoints]&.each do |spec| label, cps_str = spec.split("=", 2) cps = cps_str.split(",").map { |h| Integer(h) } stitcher.include_codepoints(cps, from: label) end stitcher.include_notdef(from: [:notdef_from]) if [:notdef_from] stitcher.write_to([:output], format: [:to].to_sym) puts "wrote #{[:output]} (#{File.size([:output])} bytes)" end |