Class: PDF::Writer::Object::FontDescriptor
- Inherits:
-
PDF::Writer::Object
- Object
- PDF::Writer::Object
- PDF::Writer::Object::FontDescriptor
- Defined in:
- lib/extensions/pdf-writer/pdf/writer/object/fontdescriptor.rb
Overview
A font descriptor, needed for including additional fonts. options
is a Hash with one of the following keys: Ascent, CapHeight, Descent, Flags, ItalicAngle, StemV, AvgWidth, Leading, MaxWidth, MissingWidth, StemH, XHeight, CharSet, FontFile, FontFile2, FontFile3, FontBBox, or FontName.
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Attributes inherited from PDF::Writer::Object
Instance Method Summary collapse
-
#initialize(parent, options = nil) ⇒ FontDescriptor
constructor
A new instance of FontDescriptor.
- #to_s ⇒ Object
Constructor Details
#initialize(parent, options = nil) ⇒ FontDescriptor
Returns a new instance of FontDescriptor.
16 17 18 19 20 |
# File 'lib/extensions/pdf-writer/pdf/writer/object/fontdescriptor.rb', line 16 def initialize(parent, = nil) super(parent) @options = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
22 23 24 |
# File 'lib/extensions/pdf-writer/pdf/writer/object/fontdescriptor.rb', line 22 def @options end |
Instance Method Details
#to_s ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/extensions/pdf-writer/pdf/writer/object/fontdescriptor.rb', line 24 def to_s res = "\n#{@oid} 0 obj\n<< /Type /FontDescriptor\n" @options.each do |k, v| res << "/#{k} #{v}\n" if %w{Ascent CapHeight Descent Flags ItalicAngle StemV AvgWidth Leading MaxWidth MissingWidth StemH XHeight CharSet}.include?(k) res << "/#{k} #{v} 0 R\n" if %w{FontFile FontFile2 FontFile3}.include?(k) res << "/#{k} [#{v.join(' ')}]\n" if k == "FontBBox" res << "/#{k} /#{v}\n" if k == "FontName" end res << ">>\nendobj" end |