Class: Fontisan::Commands::InfoCommand

Inherits:
BaseCommand show all
Defined in:
lib/fontisan/commands/info_command.rb

Overview

Command to extract font or collection metadata information.

This command auto-detects whether the input is a collection (TTC/OTC) or individual font (TTF/OTF) and returns the appropriate model:

  • CollectionInfo for TTC/OTC files

  • FontInfo for TTF/OTF files

For individual fonts, extracts comprehensive information from various tables:

  • name table: family names, version, copyright, etc.

  • OS/2 table: vendor ID, embedding permissions

  • head table: font revision, units per em

Examples:

Extract font information

command = InfoCommand.new("path/to/font.ttf")
info = command.run
puts info.family_name

Extract collection information

command = InfoCommand.new("path/to/fonts.ttc")
info = command.run
puts "Collection has #{info.num_fonts} fonts"

Instance Method Summary collapse

Methods inherited from BaseCommand

#initialize

Constructor Details

This class inherits a constructor from Fontisan::Commands::BaseCommand

Instance Method Details

#runModels::FontInfo, Models::CollectionInfo

Extract information from font or collection.

Auto-detects file type and returns appropriate model.

Returns:



32
33
34
35
36
37
38
# File 'lib/fontisan/commands/info_command.rb', line 32

def run
  if FontLoader.collection?(@font_path)
    collection_info
  else
    font_info
  end
end