Sha256: da0a713118fadcd6e8745dce8e2fb37ddc8326cc42bdbb2e517db0ed78a957fc

Contents?: true

Size: 465 Bytes

Versions: 3

Compression:

Stored size: 465 Bytes

Contents

module MojoMagick
  class Font
    attr_accessor :name, :family, :style, :stretch, :weight, :glyphs

    def valid?
      !name.nil?
    end

    def initialize(property_hash = {})
      property_hash.symbolize_keys!
      %i[name family style stretch weight glyphs].each do |f|
        setter = "#{f}="
        send(setter, property_hash[f])
      end
    end

    def self.all
      ImageMagick::Font.all.map { |font_info| Font.new(font_info) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mojo_magick-0.6.2 lib/mojo_magick/font.rb
mojo_magick-0.6.0 lib/mojo_magick/font.rb
mojo_magick-0.5.7 lib/mojo_magick/font.rb