Class: JotPDF::Document::StandardFont
- Inherits:
-
Object
- Object
- JotPDF::Document::StandardFont
- Defined in:
- lib/jot_pdf/document.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ StandardFont
constructor
A new instance of StandardFont.
- #unicode_to_code(codepoint) ⇒ Object
- #use(text) ⇒ Object
Constructor Details
#initialize(name) ⇒ StandardFont
Returns a new instance of StandardFont.
11 12 13 |
# File 'lib/jot_pdf/document.rb', line 11 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/jot_pdf/document.rb', line 9 def name @name end |
Instance Method Details
#unicode_to_code(codepoint) ⇒ Object
15 16 17 18 19 |
# File 'lib/jot_pdf/document.rb', line 15 def unicode_to_code(codepoint) raise if codepoint > 255 codepoint end |
#use(text) ⇒ Object
21 22 23 |
# File 'lib/jot_pdf/document.rb', line 21 def use(text) text.each_codepoint.map { |c| format("%02x", unicode_to_code(c)) }.join end |