Method: PDF::Writer::Object::Font#initialize

Defined in:
lib/pdf/writer/object/font.rb

#initialize(parent, name, encoding = 'WinAnsiEncoding', subtype = 'Type1') ⇒ Font

Returns a new instance of Font.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/pdf/writer/object/font.rb', line 15

def initialize(parent, name, encoding = 'WinAnsiEncoding', subtype = 'Type1')
  super(parent)

  @name     = name
  @subtype  = subtype
  @font_id  = @parent.__send__(:generate_font_id)

  if encoding.kind_of?(PDF::Writer::Object::FontEncoding)
    @encoding           = encoding
  elsif encoding == 'none' or encoding.nil?
    @encoding           = nil
  else
    @encoding           = encoding
  end

  @parent.pages << self

  @firstchar      = nil
  @lastchar       = nil
  @widths         = nil
  @fontdescriptor = nil
end