Class: Clef::Engraving::FontManager
- Inherits:
-
Object
- Object
- Clef::Engraving::FontManager
- Defined in:
- lib/clef/engraving/font_manager.rb
Instance Attribute Summary collapse
-
#font_path ⇒ Object
readonly
Returns the value of attribute font_path.
Instance Method Summary collapse
- #font_available? ⇒ Boolean
-
#initialize(font_path: default_font_path) ⇒ FontManager
constructor
A new instance of FontManager.
- #register_with(pdf, family_name: "Bravura") ⇒ String
Constructor Details
#initialize(font_path: default_font_path) ⇒ FontManager
Returns a new instance of FontManager.
9 10 11 |
# File 'lib/clef/engraving/font_manager.rb', line 9 def initialize(font_path: default_font_path) @font_path = font_path end |
Instance Attribute Details
#font_path ⇒ Object (readonly)
Returns the value of attribute font_path.
6 7 8 |
# File 'lib/clef/engraving/font_manager.rb', line 6 def font_path @font_path end |
Instance Method Details
#font_available? ⇒ Boolean
14 15 16 |
# File 'lib/clef/engraving/font_manager.rb', line 14 def font_available? File.exist?(font_path) end |
#register_with(pdf, family_name: "Bravura") ⇒ String
21 22 23 24 25 26 |
# File 'lib/clef/engraving/font_manager.rb', line 21 def register_with(pdf, family_name: "Bravura") return "Helvetica" unless font_available? pdf.font_families.update(family_name => {normal: font_path}) family_name end |