Class: Blacksmith::Font
- Inherits:
-
Object
- Object
- Blacksmith::Font
- Includes:
- SmartProperties
- Defined in:
- lib/blacksmith/font.rb
Instance Method Summary collapse
- #<<(glyph) ⇒ Object
- #baseline ⇒ Object
- #basename ⇒ Object
- #glyphs ⇒ Object
- #identifier ⇒ Object
- #name ⇒ Object
- #origin ⇒ Object
- #to_fontforge_build_instructions ⇒ Object
- #to_fontforge_conversion_instructions ⇒ Object
Instance Method Details
#<<(glyph) ⇒ Object
79 80 81 82 |
# File 'lib/blacksmith/font.rb', line 79 def <<(glyph) @glyphs ||= [] @glyphs << glyph end |
#baseline ⇒ Object
84 85 86 |
# File 'lib/blacksmith/font.rb', line 84 def baseline super or (1.0 * descent) / (ascent + descent) end |
#basename ⇒ Object
71 72 73 |
# File 'lib/blacksmith/font.rb', line 71 def basename [family.gsub(/\W+/, ''), weight.gsub(/\W+/, '')].join('-') end |
#glyphs ⇒ Object
75 76 77 |
# File 'lib/blacksmith/font.rb', line 75 def glyphs (@glyphs || []).dup end |
#identifier ⇒ Object
67 68 69 |
# File 'lib/blacksmith/font.rb', line 67 def identifier name.gsub(/\W+/, '_').downcase end |
#name ⇒ Object
63 64 65 |
# File 'lib/blacksmith/font.rb', line 63 def name super || [family, weight].join(' ') end |
#origin ⇒ Object
88 89 90 |
# File 'lib/blacksmith/font.rb', line 88 def origin Blacksmith::Point.new(0, (ascent + descent) * baseline - descent) end |
#to_fontforge_build_instructions ⇒ Object
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_instructions ⇒ Object
96 97 98 |
# File 'lib/blacksmith/font.rb', line 96 def to_fontforge_conversion_instructions fontforge_conversion_instructions_template.result(binding) end |