class PDF::Writer::Object::FontDescriptor

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.

Attributes

options[RW]

Public Class Methods

new(parent, options = nil) click to toggle source
Calls superclass method PDF::Writer::Object::new
   # File lib/pdf/writer/object/fontdescriptor.rb
16 def initialize(parent, options = nil)
17   super(parent)
18 
19   @options = options
20 end

Public Instance Methods

to_s() click to toggle source
   # File lib/pdf/writer/object/fontdescriptor.rb
24 def to_s
25   res = "\n#{@oid} 0 obj\n<< /Type /FontDescriptor\n"
26   @options.each do |k, v|
27     res << "/#{k} #{v}\n" if %w{Ascent CapHeight Descent Flags ItalicAngle StemV AvgWidth Leading MaxWidth MissingWidth StemH XHeight CharSet}.include?(k)
28     res << "/#{k} #{v} 0 R\n" if %w{FontFile FontFile2 FontFile3}.include?(k)
29     res << "/#{k} [#{v.join(' ')}]\n" if k == "FontBBox"
30     res << "/#{k} /#{v}\n" if k == "FontName"
31   end
32   res << ">>\nendobj"
33 end