Class: Text2Path::SvgFont
- Inherits:
-
Object
- Object
- Text2Path::SvgFont
- Defined in:
- lib/text2path/svg_font.rb
Overview
An SVG font is a font defined using SVG’s ‘font’ element. You may be instested in the specification of svg font: – www.w3.org/TR/SVG/fonts.html
Instance Attribute Summary collapse
-
#advance_x ⇒ Object
readonly
Returns the value of attribute advance_x.
-
#advance_y ⇒ Object
readonly
Returns the value of attribute advance_y.
-
#glyphs ⇒ Object
readonly
Returns the value of attribute glyphs.
-
#units_per_em ⇒ Object
readonly
Returns the value of attribute units_per_em.
Instance Method Summary collapse
- #default_glyph_height ⇒ Object
- #glyph(letter) ⇒ Object
-
#initialize(font_path) {|_self| ... } ⇒ SvgFont
constructor
A new instance of SvgFont.
Constructor Details
#initialize(font_path) {|_self| ... } ⇒ SvgFont
Returns a new instance of SvgFont.
24 25 26 27 28 |
# File 'lib/text2path/svg_font.rb', line 24 def initialize( font_path ) @font_path = font_path load_font yield self if block_given? end |
Instance Attribute Details
#advance_x ⇒ Object (readonly)
Returns the value of attribute advance_x.
21 22 23 |
# File 'lib/text2path/svg_font.rb', line 21 def advance_x @advance_x end |
#advance_y ⇒ Object (readonly)
Returns the value of attribute advance_y.
21 22 23 |
# File 'lib/text2path/svg_font.rb', line 21 def advance_y @advance_y end |
#glyphs ⇒ Object (readonly)
Returns the value of attribute glyphs.
22 23 24 |
# File 'lib/text2path/svg_font.rb', line 22 def glyphs @glyphs end |
#units_per_em ⇒ Object (readonly)
Returns the value of attribute units_per_em.
22 23 24 |
# File 'lib/text2path/svg_font.rb', line 22 def units_per_em @units_per_em end |
Instance Method Details
#default_glyph_height ⇒ Object
30 31 32 |
# File 'lib/text2path/svg_font.rb', line 30 def default_glyph_height units_per_em end |
#glyph(letter) ⇒ Object
34 35 36 37 |
# File 'lib/text2path/svg_font.rb', line 34 def glyph( letter ) key = letter.respond_to?(:ord) ? letter.ord : letter.to_i glyphs[key] #|| missing_glyph end |