Class: Fontisan::Commands::InstanceCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- Fontisan::Commands::InstanceCommand
- Defined in:
- lib/fontisan/commands/instance_command.rb
Overview
CLI command for generating static font instances from variable fonts
Provides command-line interface for:
-
Instancing at specific coordinates
-
Using named instances
-
Converting output format during instancing
-
Listing available instances
-
Validation before generation
-
Dry-run mode for previewing
-
Progress tracking
Instance Method Summary collapse
-
#execute(input_path, options = {}) ⇒ Object
Instance a variable font at specified coordinates.
Methods inherited from BaseCommand
Constructor Details
This class inherits a constructor from Fontisan::Commands::BaseCommand
Instance Method Details
#execute(input_path, options = {}) ⇒ Object
Instance a variable font at specified coordinates
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/fontisan/commands/instance_command.rb', line 38 def execute(input_path, = {}) # Load variable font font = load_font(input_path) # Validate font if requested validate_font(font) if [:validate] # Handle list-instances option if [:list_instances] list_instances(font) return end # Handle dry-run mode if [:dry_run] preview_instance(font, input_path, ) return end # Determine output path output_path = determine_output_path(input_path, ) # Generate instance if [:named_instance] instance_named(font, [:named_instance], output_path, ) else instance_coords(font, extract_coordinates(), output_path, ) end puts "Static font instance written to: #{output_path}" rescue VariationError => e warn "Variation Error: #{e.}" exit 1 rescue StandardError => e warn "Error: #{e.}" warn e.backtrace.first(5).join("\n") if [:verbose] exit 1 end |