Class: Fontist::Import::OtfStyle

Inherits:
Object
  • Object
show all
Defined in:
lib/fontist/import/otf_style.rb

Instance Method Summary collapse

Constructor Details

#initialize(info, path) ⇒ OtfStyle

Returns a new instance of OtfStyle.


4
5
6
7
# File 'lib/fontist/import/otf_style.rb', line 4

def initialize(info, path)
  @info = info
  @path = path
end

Instance Method Details

#callObject


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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