Class: Blacksmith::Font

Inherits:
Object
  • Object
show all
Includes:
SmartProperties
Defined in:
lib/blacksmith/font.rb

Instance Method Summary collapse

Instance Method Details

#<<(glyph) ⇒ Object



79
80
81
82
# File 'lib/blacksmith/font.rb', line 79

def <<(glyph)
  @glyphs ||= []
  @glyphs << glyph
end

#baselineObject



84
85
86
# File 'lib/blacksmith/font.rb', line 84

def baseline
  super or (1.0 * descent) / (ascent + descent)
end

#basenameObject



71
72
73
# File 'lib/blacksmith/font.rb', line 71

def basename
  [family.gsub(/\W+/, ''), weight.gsub(/\W+/, '')].join('-')
end

#glyphsObject



75
76
77
# File 'lib/blacksmith/font.rb', line 75

def glyphs
  (@glyphs || []).dup
end

#identifierObject



67
68
69
# File 'lib/blacksmith/font.rb', line 67

def identifier
  name.gsub(/\W+/, '_').downcase
end

#nameObject



63
64
65
# File 'lib/blacksmith/font.rb', line 63

def name
  super || [family, weight].join(' ')
end

#originObject



88
89
90
# File 'lib/blacksmith/font.rb', line 88

def origin
  Blacksmith::Point.new(0, (ascent + descent) * baseline - descent)
end

#to_fontforge_build_instructionsObject



92
93
94
# File 'lib/blacksmith/font.rb', line 92

def to_fontforge_build_instructions
  fontforge_build_instructions_template.result(binding)
end

#to_fontforge_conversion_instructionsObject



96
97
98
# File 'lib/blacksmith/font.rb', line 96

def to_fontforge_conversion_instructions
  fontforge_conversion_instructions_template.result(binding)
end