Class: DragonflyFonts::Processors::CorrectMetrics

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

Instance Method Summary collapse

Instance Method Details

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

Raises:



4
5
6
7
8
9
10
11
# File 'lib/dragonfly_fonts/processors/correct_metrics.rb', line 4

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

  content.shell_update(ext: content.ext || 'ttf') do |old_path, new_path|
    "#{fontforge_command} -lang=ff -c 'Open($1); SetOS2Value(\"HHeadAscent\",$ascent); SetOS2Value(\"HHeadAscentIsOffset\",0); SetOS2Value(\"HHeadDescent\",-$descent); SetOS2Value(\"HHeadDescentIsOffset\",0); SetOS2Value(\"TypoLineGap\",0); Generate($2);' #{old_path} #{new_path}"
  end
end

#update_url(attrs, *args) ⇒ Object



13
14
15
# File 'lib/dragonfly_fonts/processors/correct_metrics.rb', line 13

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