Class: DragonflyFonts::Processors::OtsSanitize

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

Instance Method Summary collapse

Instance Method Details

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

The OpenType Sanitiser (OTS) parses and serialises OpenType files (OTF, TTF) and WOFF and WOFF2 font files, validating them and sanitising them as it goes. TODO: if other then convert first

Raises:



6
7
8
9
10
11
12
13
# File 'lib/dragonfly_fonts/processors/ots_sanitize.rb', line 6

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

  content.shell_update(ext: content.ext || 'ttf') do |old_path, new_path|
    "#{ots_sanitize_command} #{old_path} #{new_path}"
  end
end

#update_url(attrs, *_args) ⇒ Object



15
16
17
# File 'lib/dragonfly_fonts/processors/ots_sanitize.rb', line 15

def update_url(attrs, *_args)
  attrs.style = 'ots-sanitize'
end