Class: PDF::Writer::Object::FontEncoding
- Inherits:
-
PDF::Writer::Object
- Object
- PDF::Writer::Object
- PDF::Writer::Object::FontEncoding
- Defined in:
- lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/fontencoding.rb
Overview
The font encoding
Instance Attribute Summary collapse
-
#differences ⇒ Object
Returns the value of attribute differences.
-
#encoding ⇒ Object
Returns the value of attribute encoding.
Attributes inherited from PDF::Writer::Object
Instance Method Summary collapse
-
#initialize(parent, encoding, differences) ⇒ FontEncoding
constructor
A new instance of FontEncoding.
- #to_s ⇒ Object
Constructor Details
#initialize(parent, encoding, differences) ⇒ FontEncoding
Returns a new instance of FontEncoding.
13 14 15 16 17 18 |
# File 'lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/fontencoding.rb', line 13 def initialize(parent, encoding, differences) super(parent) @differences = differences @encoding = encoding end |
Instance Attribute Details
#differences ⇒ Object
Returns the value of attribute differences.
20 21 22 |
# File 'lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/fontencoding.rb', line 20 def differences @differences end |
#encoding ⇒ Object
Returns the value of attribute encoding.
21 22 23 |
# File 'lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/fontencoding.rb', line 21 def encoding @encoding end |
Instance Method Details
#to_s ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/fontencoding.rb', line 23 def to_s res = "\n#{@oid} 0 obj\n<< /Type /Encoding\n" enc = @encoding || 'WinAnsiEncoding' res << "/BaseEncoding /#{enc}\n" unless enc == 'none' unless @differences.nil? or @differences.empty? res << "/Differences \n[" n = nil @differences.keys.sort.each do |k| # Cannot make use of consecutive numbering res << "\n#{k} " if n.nil? or k != (n + 1) res << " /#{@differences[k]}" n = k end res << "\n]" end res << "\n>>\nendobj" end |