Class: Fontisan::Commands::DumpTableCommand
- Inherits:
-
Object
- Object
- Fontisan::Commands::DumpTableCommand
- Defined in:
- lib/fontisan/commands/dump_table_command.rb
Overview
Command to dump raw table data from fonts
This command extracts the binary data of a specific OpenType table and outputs it directly. This is useful for examining table contents or extracting tables for external processing.
Instance Method Summary collapse
-
#initialize(font_path, table_tag, options = {}) ⇒ DumpTableCommand
constructor
Initialize a new dump table command.
-
#run ⇒ String
Execute the dump table command.
Constructor Details
#initialize(font_path, table_tag, options = {}) ⇒ DumpTableCommand
Initialize a new dump table command
17 18 19 20 21 22 |
# File 'lib/fontisan/commands/dump_table_command.rb', line 17 def initialize(font_path, table_tag, = {}) @font_path = font_path @table_tag = table_tag @options = @font = load_font end |
Instance Method Details
#run ⇒ String
Execute the dump table command
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fontisan/commands/dump_table_command.rb', line 28 def run unless @font.has_table?(@table_tag) raise Error, "Font does not have '#{@table_tag}' table" end # Get raw table data table_data = @font.instance_variable_get(:@table_data) raw_data = table_data[@table_tag] unless raw_data raise Error, "Table data not available for '#{@table_tag}'" end raw_data end |