class Fontist::Import::OtfStyle

Public Class Methods

new(info, path) click to toggle source
# File lib/fontist/import/otf_style.rb, line 4
def initialize(info, path)
  @info = info
  @path = path
end

Public Instance Methods

call() click to toggle source
# File lib/fontist/import/otf_style.rb, line 9
def call
  style = { family_name: @info["Family"],
            style: @info["Subfamily"],
            full_name: @info["Full name"],
            post_script_name: @info["PostScript name"],
            version: version(@info["Version"]),
            description: @info["Description"],
            filename: File.basename(@path),
            copyright: @info["Copyright"] }

  if @info["Preferred family"]
    style[:preferred_family_name] = @info["Preferred family"]
  end

  if @info["Preferred subfamily"]
    style[:preferred_style] = @info["Preferred subfamily"]
  end

  OpenStruct.new(style)
end