Class: DragonflyFonts::Processors::ExtractGlyph
- Inherits:
-
Object
- Object
- DragonflyFonts::Processors::ExtractGlyph
- Defined in:
- lib/dragonfly_fonts/processors/extract_glyph.rb
Instance Method Summary collapse
- #call(content, glyph, options = {}) ⇒ Object
- #update_url(url_attributes, glyph, options = {}) ⇒ Object
Instance Method Details
#call(content, glyph, options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/dragonfly_fonts/processors/extract_glyph.rb', line 4 def call(content, glyph, = {}) raise UnsupportedFormat unless content.ext raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase) = .each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys format = .fetch('format', 'svg').to_s content.shell_update(ext: format) do |old_path, new_path| "#{fontforge_command} -lang=ff -c 'Open($1); Select($2); Export($3);' #{old_path} #{glyph} #{new_path}" end content.['format'] = format content.ext = format end |
#update_url(url_attributes, glyph, options = {}) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/dragonfly_fonts/processors/extract_glyph.rb', line 19 def update_url(url_attributes, glyph, = {}) = .each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys format = .fetch('format', 'svg').to_s url_attributes.ext = format url_attributes.glyph = glyph end |