Class: HexaPDF::Type::Font

Inherits:
Dictionary show all
Defined in:
lib/hexapdf/type/font.rb

Overview

Represents a generic font object.

This class is the base class for all font objects, be it simple fonts or composite fonts.

Direct Known Subclasses

FontSimple

Constant Summary

Constants included from DictionaryFields

DictionaryFields::Boolean, DictionaryFields::PDFByteString, DictionaryFields::PDFDate

Constants inherited from Object

Object::NOT_DUPLICATABLE_CLASSES

Instance Attribute Summary

Attributes inherited from Object

#data, #document, #must_be_indirect

Instance Method Summary collapse

Methods inherited from Dictionary

#[], #[]=, define_field, #delete, #each, each_field, #empty?, field, #key?, #to_hash, #type

Methods inherited from Object

#<=>, #==, #deep_copy, deep_copy, #document?, #eql?, #gen, #gen=, #hash, #indirect?, #initialize, #inspect, #null?, #oid, #oid=, #type, #validate, #value, #value=

Constructor Details

This class inherits a constructor from HexaPDF::Object

Instance Method Details

#must_be_indirect?Boolean

Font objects must always be indirect.

Returns:



50
51
52
# File 'lib/hexapdf/type/font.rb', line 50

def must_be_indirect?
  true
end

#to_utf8(code) ⇒ Object

Returns the UTF-8 string for the given character code, or an empty string if no mapping was found.



56
57
58
59
60
61
62
# File 'lib/hexapdf/type/font.rb', line 56

def to_utf8(code)
  if to_unicode_cmap
    to_unicode_cmap.to_unicode(code)
  else
    ''.freeze
  end
end