Sha256: 6ba6faa50f123ed0872782768be5389559e9101c3efc5fde8b3f8ed21ec53e9b

Contents?: true

Size: 1.18 KB

Versions: 7

Compression:

Stored size: 1.18 KB

Contents

#--
# PDF::Writer for Ruby.
#   http://rubyforge.org/projects/ruby-pdf/
#   Copyright 2003 - 2005 Austin Ziegler.
#
#   Licensed under a MIT-style licence. See LICENCE in the main distribution
#   for full licensing information.
#
# $Id$
#++
  # 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.
class PDF::Writer::Object::FontDescriptor < PDF::Writer::Object
  def initialize(parent, options = nil)
    super(parent)

    @options = options
  end

  attr_accessor :options

  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
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
ypdf-writer-1.3.5 lib/pdf/writer/object/fontdescriptor.rb
ypdf-writer-1.3.3 lib/pdf/writer/object/fontdescriptor.rb
ypdf-writer-1.3.2 lib/pdf/writer/object/fontdescriptor.rb
metaskills-pdf-writer-1.2.2 lib/pdf/writer/object/fontdescriptor.rb
metaskills-pdf-writer-1.2.3 lib/pdf/writer/object/fontdescriptor.rb
eventioz-pdf-writer-1.2.4 lib/pdf/writer/object/fontdescriptor.rb
eventioz-pdf-writer-1.0 lib/pdf/writer/object/fontdescriptor.rb