Class: DragonflyFonts::Processors::SetUnderline

Inherits:
Object
  • Object
show all
Defined in:
lib/dragonfly_fonts/processors/set_underline.rb

Instance Method Summary collapse

Instance Method Details

#call(content, options = {}) ⇒ Object

Raises:



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/dragonfly_fonts/processors/set_underline.rb', line 6

def call(content, options = {})
  raise UnsupportedFormat unless content.ext
  raise UnsupportedFormat unless FONT_FORGE_SUPPORTED_FORMATS.include?(content.ext.downcase)

  options = options.each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys
  upos = options.fetch('upos', '')
  uwidth = options.fetch('uwidth', '')

  content.shell_update(ext: content.ext || 'ttf') do |old_path, new_path|
    "#{underline_script} #{old_path} #{new_path} #{Shellwords.escape(upos)} #{Shellwords.escape(uwidth)}"
  end
end

#update_url(attrs, *args) ⇒ Object



19
20
21
# File 'lib/dragonfly_fonts/processors/set_underline.rb', line 19

def update_url(attrs, *args)
  attrs.style = 'adjunderline'
end