class Fontist::Import::Otf::FontFile
Constants
- COLLECTION_ATTRIBUTES
- REQUIREMENTS
- STYLE_ATTRIBUTES
Attributes
Public Class Methods
Source
# File lib/fontist/import/otf/font_file.rb, line 24 def initialize(path, name_prefix: nil) @path = path @name_prefix = name_prefix @info = read @extension = detect_extension end
Public Instance Methods
Source
# File lib/fontist/import/otf/font_file.rb, line 87 def copyright info["Copyright"] end
Source
# File lib/fontist/import/otf/font_file.rb, line 73 def description info["Description"] end
Source
# File lib/fontist/import/otf/font_file.rb, line 39 def family_name name = info["Family"] @name_prefix ? "#{@name_prefix}#{name}" : name end
Source
# File lib/fontist/import/otf/font_file.rb, line 77 def font basename = File.basename(@path, ".*").chomp(".#{@extension}") "#{basename}.#{@extension}" end
Source
# File lib/fontist/import/otf/font_file.rb, line 59 def full_name info["Full name"] end
Source
# File lib/fontist/import/otf/font_file.rb, line 91 def homepage info["Vendor URL"] end
Source
# File lib/fontist/import/otf/font_file.rb, line 95 def license_url info["License URL"] end
Source
# File lib/fontist/import/otf/font_file.rb, line 63 def post_script_name info["PostScript name"] end
Source
# File lib/fontist/import/otf/font_file.rb, line 48 def preferred_family_name name = info["Preferred family"] return unless name @name_prefix ? "#{@name_prefix}#{name}" : name end
Source
# File lib/fontist/import/otf/font_file.rb, line 55 def preferred_type info["Preferred subfamily"] end
Source
# File lib/fontist/import/otf/font_file.rb, line 83 def source_font File.basename(@path) unless font == File.basename(@path) end
Source
# File lib/fontist/import/otf/font_file.rb, line 35 def to_collection_style COLLECTION_ATTRIBUTES.to_h { |name| [name, send(name)] }.compact end
Source
# File lib/fontist/import/otf/font_file.rb, line 31 def to_style STYLE_ATTRIBUTES.to_h { |name| [name, send(name)] }.compact end
Source
# File lib/fontist/import/otf/font_file.rb, line 67 def version return unless info["Version"] info["Version"].gsub("Version ", "") end