Module: GlyphImager

Defined in:
lib/glyph_imager.rb

Defined Under Namespace

Classes: FontRecord, Imager

Class Method Summary collapse

Class Method Details

.image_character_for_font(options = {}) ⇒ Object



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

def self.image_character_for_font(options = {})
  %w[code_point font_path output_dir].each do |k|
    if options[k.to_sym].nil?
      raise ArgumentError, "missing value for :#{k}"
    end
  end
  font = FontRecord.new(options[:font_path])
  if font.has_glyph_for_unicode_char?(options[:code_point])
    imager = GlyphImager::Imager.new(options)
    imager.create_image
    return imager
  end
end