Class | PDF::Writer::Object::FontDescriptor |
In: |
lib/pdf/writer/object/fontdescriptor.rb
|
Parent: | PDF::Writer::Object |
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.
options | [RW] |
# File lib/pdf/writer/object/fontdescriptor.rb, line 16 16: def initialize(parent, options = nil) 17: super(parent) 18: 19: @options = options 20: end
# File lib/pdf/writer/object/fontdescriptor.rb, line 24 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 << "\n>>\nendobj" 33: end