Class: JotPDF::Document::StandardFont

Inherits:
Object
  • Object
show all
Defined in:
lib/jot_pdf/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (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