Class: Fontist::Import::FontMetadataExtractor
- Inherits:
-
Object
- Object
- Fontist::Import::FontMetadataExtractor
- Defined in:
- lib/fontist/import/font_metadata_extractor.rb
Instance Method Summary collapse
- #extract ⇒ Object
-
#initialize(path) ⇒ FontMetadataExtractor
constructor
A new instance of FontMetadataExtractor.
Constructor Details
#initialize(path) ⇒ FontMetadataExtractor
Returns a new instance of FontMetadataExtractor.
6 7 8 |
# File 'lib/fontist/import/font_metadata_extractor.rb', line 6 def initialize(path) @path = path end |
Instance Method Details
#extract ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fontist/import/font_metadata_extractor.rb', line 10 def extract # Use FontLoader directly for consistent handling of both # individual fonts and collections (TTC/OTC) # For TTC files, loads the first font (index 0) by default font = Fontisan::FontLoader.load( @path, font_index: 0, mode: Fontisan::LoadingModes::METADATA, ) (font) rescue StandardError => e raise Errors::FontExtractError, "Failed to extract metadata from #{@path}: #{e.}" end |