Class: Fontisan::Cli
- Inherits:
-
Thor
- Object
- Thor
- Fontisan::Cli
- Defined in:
- lib/fontisan/cli.rb
Overview
Command-line interface for Fontisan.
This class provides the Thor-based CLI with commands for extracting font information and listing tables. It supports multiple output formats (text, YAML, JSON) and various options for controlling output behavior.
Instance Method Summary collapse
-
#dump_table(font_file, table_tag) ⇒ Object
Dump raw binary table data to stdout.
-
#features(font_file) ⇒ Object
List OpenType features available for scripts.
-
#glyphs(font_file) ⇒ Object
List glyph names from the font file.
-
#info(font_file) ⇒ Object
Extract and display comprehensive font metadata.
-
#optical_size(font_file) ⇒ Object
Display optical size information from the font file.
-
#scripts(font_file) ⇒ Object
List all scripts supported by the font from GSUB and GPOS tables.
-
#tables(font_file) ⇒ Object
List all OpenType tables in the font file.
-
#unicode(font_file) ⇒ Object
List Unicode to glyph index mappings from the font file.
-
#variable(font_file) ⇒ Object
Display variable font variation axes and instances.
-
#version ⇒ Object
Display the Fontisan version.
Instance Method Details
#dump_table(font_file, table_tag) ⇒ Object
Dump raw binary table data to stdout.
133 134 135 136 137 138 139 140 141 142 |
# File 'lib/fontisan/cli.rb', line 133 def dump_table(font_file, table_tag) command = Commands::DumpTableCommand.new(font_file, table_tag, ) raw_data = command.run # Write binary data directly to stdout $stdout.binmode $stdout.write(raw_data) rescue Errno::ENOENT, Error => e handle_error(e) end |
#features(font_file) ⇒ Object
List OpenType features available for scripts. If no script is specified, shows features for all scripts.
120 121 122 123 124 125 126 |
# File 'lib/fontisan/cli.rb', line 120 def features(font_file) command = Commands::FeaturesCommand.new(font_file, ) result = command.run output_result(result) rescue Errno::ENOENT, Error => e handle_error(e) end |
#glyphs(font_file) ⇒ Object
List glyph names from the font file.
56 57 58 59 60 61 62 |
# File 'lib/fontisan/cli.rb', line 56 def glyphs(font_file) command = Commands::GlyphsCommand.new(font_file, ) result = command.run output_result(result) rescue Errno::ENOENT, Error => e handle_error(e) end |
#info(font_file) ⇒ Object
Extract and display comprehensive font metadata.
32 33 34 35 36 37 38 |
# File 'lib/fontisan/cli.rb', line 32 def info(font_file) command = Commands::InfoCommand.new(font_file, ) result = command.run output_result(result) rescue Errno::ENOENT, Error => e handle_error(e) end |
#optical_size(font_file) ⇒ Object
Display optical size information from the font file.
92 93 94 95 96 97 98 |
# File 'lib/fontisan/cli.rb', line 92 def optical_size(font_file) command = Commands::OpticalSizeCommand.new(font_file, ) result = command.run output_result(result) rescue Errno::ENOENT, Error => e handle_error(e) end |
#scripts(font_file) ⇒ Object
List all scripts supported by the font from GSUB and GPOS tables.
104 105 106 107 108 109 110 |
# File 'lib/fontisan/cli.rb', line 104 def scripts(font_file) command = Commands::ScriptsCommand.new(font_file, ) result = command.run output_result(result) rescue Errno::ENOENT, Error => e handle_error(e) end |
#tables(font_file) ⇒ Object
List all OpenType tables in the font file.
44 45 46 47 48 49 50 |
# File 'lib/fontisan/cli.rb', line 44 def tables(font_file) command = Commands::TablesCommand.new(font_file, ) result = command.run output_result(result) rescue Errno::ENOENT, Error => e handle_error(e) end |
#unicode(font_file) ⇒ Object
List Unicode to glyph index mappings from the font file.
68 69 70 71 72 73 74 |
# File 'lib/fontisan/cli.rb', line 68 def unicode(font_file) command = Commands::UnicodeCommand.new(font_file, ) result = command.run output_result(result) rescue Errno::ENOENT, Error => e handle_error(e) end |
#variable(font_file) ⇒ Object
Display variable font variation axes and instances.
80 81 82 83 84 85 86 |
# File 'lib/fontisan/cli.rb', line 80 def variable(font_file) command = Commands::VariableCommand.new(font_file, ) result = command.run output_result(result) rescue Errno::ENOENT, Error => e handle_error(e) end |