class 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
# File lib/pdf/writer/object/fontdescriptor.rb, line 16
def initialize(parent, options = nil)
  super(parent)

  @options = options
end

Public Instance Methods

to_s() click to toggle source
# File lib/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