Class PDF::Writer::Object::Font
In: lib/pdf/writer/object/font.rb
Parent: PDF::Writer::Object
Transaction::Simple SimpleTable TechBook Complex Action Procset FontDescriptor FontEncoding Destination Info Catalog Encryption Contents Pages Outline Outlines Annotation Page Font ViewerPreferences Image Hash OHash QuickRef FontMetrics ARC4 StrokeStyle PolygonPoint ImageInfo StdDev lib/pdf/simpletable.rb lib/pdf/techbook.rb lib/pdf/writer.rb lib/pdf/quickref.rb Math lib/pdf/writer/fontmetrics.rb lib/pdf/writer/ohash.rb lib/pdf/writer/arc4.rb lib/pdf/writer/strokestyle.rb lib/pdf/writer/graphics.rb lib/pdf/writer/object.rb lib/pdf/writer/object/image.rb External EN Lang OffsetReader lib/pdf/writer/graphics/imageinfo.rb Graphics lib/pdf/writer/object/outlines.rb lib/pdf/writer/object/destination.rb lib/pdf/writer/object/viewerpreferences.rb lib/pdf/writer/object/fontencoding.rb lib/pdf/writer/object/page.rb lib/pdf/writer/object/contents.rb lib/pdf/writer/object/procset.rb lib/pdf/writer/object/pages.rb lib/pdf/writer/object/info.rb lib/pdf/writer/object/encryption.rb lib/pdf/writer/object/catalog.rb lib/pdf/writer/object/outline.rb lib/pdf/writer/object/fontdescriptor.rb lib/pdf/writer/object/action.rb lib/pdf/writer/object/font.rb lib/pdf/writer/object/annotation.rb Object Writer lib/pdf/charts/stddev.rb Charts PDF dot/m_33_0.png

An object to hold the font description

Methods

new   to_s  

Constants

Details = %w{FirstChar LastChar Widths FontDescriptor SubType}

Attributes

basefont  [R] 
encoding  [R]  Valid values: WinAnsiEncoding, MacRomanEncoding, MacExpertEncoding, none, nil, or an instance of PDF::Writer::Object::FontEncoding.
font_id  [R] 
subtype  [R]  The type of the font: Type1 and TrueType are the only values supported by

Public Class methods

[Source]

    # File lib/pdf/writer/object/font.rb, line 15
15:   def initialize(parent, name, encoding = 'WinAnsiEncoding', subtype = 'Type1')
16:     super(parent)
17: 
18:     @name     = name
19:     @subtype  = subtype
20:     @font_id  = @parent.__send__(:generate_font_id)
21: 
22:     if encoding.kind_of?(PDF::Writer::Object::FontEncoding)
23:       @encoding           = encoding
24:     elsif encoding == 'none' or encoding.nil?
25:       @encoding           = nil
26:     else
27:       @encoding           = encoding
28:     end
29: 
30:     @parent.pages << self
31: 
32:     @firstchar      = nil
33:     @lastchar       = nil
34:     @widths         = nil
35:     @fontdescriptor = nil
36:   end

Public Instance methods

[Source]

    # File lib/pdf/writer/object/font.rb, line 54
54:   def to_s
55:     res = "\n#{@oid} 0 obj\n<< /Type /Font\n/Subtype /#{@subtype}\n"
56:     res << "/Name /F#{@font_id}\n/BaseFont /#{@name}\n"
57:     if @encoding.kind_of?(PDF::Writer::Object::FontEncoding)
58:       res << "/Encoding #{@encoding.oid} 0 R\n"
59:     elsif @encoding
60:       res << "/Encoding /#{@encoding}\n" if @encoding
61:     end
62:     res << "/FirstChar #{@firstchar}\n" unless @firstchar.nil?
63:     res << "/LastChar #{@lastchar}\n" unless @lastchar.nil?
64:     res << "/Widths #{@widths} 0 R\n" unless @widths.nil?
65:     res << "/FontDescriptor #{@fontdescriptor} 0 R\n" unless @fontdescriptor.nil?
66:     res << ">>\nendobj"
67:   end

[Validate]