Class: EideticPDF::PdfObjects::PdfFont

Inherits:
PdfDictionaryObject show all
Defined in:
lib/epdfo.rb

Overview

defines Type1, TrueType, etc font

Instance Attribute Summary

Attributes inherited from IndirectObject

#gen, #seq

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PdfDictionaryObject

#body, #dictionary

Methods inherited from IndirectObject

#body, #footer, #header, #reference_object, #reference_string, #to_s

Constructor Details

#initialize(seq, gen, sub_type, base_font, first_char, last_char, widths, font_descriptor) ⇒ PdfFont

Returns a new instance of PdfFont.



456
457
458
459
460
461
462
463
464
465
# File 'lib/epdfo.rb', line 456

def initialize(seq, gen, sub_type, base_font, first_char, last_char, widths, font_descriptor)
  super(seq, gen)
  dictionary['Type'] = PdfName.new('Font')
  dictionary['Subtype'] = PdfName.new(sub_type)
  dictionary['BaseFont'] = PdfName.new(base_font)
  dictionary['FirstChar'] = PdfInteger.new(first_char)
  dictionary['LastChar'] = PdfInteger.new(last_char)
  dictionary['Widths'] = widths.reference_object unless widths.nil?
  dictionary['FontDescriptor'] = font_descriptor.reference_object unless font_descriptor.nil?
end

Class Method Details

.standard_encoding?(encoding) ⇒ Boolean

Returns:

  • (Boolean)


467
468
469
# File 'lib/epdfo.rb', line 467

def self.standard_encoding?(encoding)
  PdfK::STANDARD_ENCODINGS.include?(encoding)
end

Instance Method Details

#encoding=(encoding) ⇒ Object



442
443
444
445
446
# File 'lib/epdfo.rb', line 442

def encoding=(encoding)
  return if encoding == 'StandardEncoding'
  encoding = PdfName.new(encoding) if encoding.is_a?(String)
  dictionary['Encoding'] = encoding
end

#font_descriptor=(font_descriptor) ⇒ Object



452
453
454
# File 'lib/epdfo.rb', line 452

def font_descriptor=(font_descriptor)
  dictionary['FontDescriptor'] = font_descriptor
end

#widths=(widths) ⇒ Object



448
449
450
# File 'lib/epdfo.rb', line 448

def widths=(widths)
  dictionary['Widths'] = widths
end