class HexaPDF::Font::Encoding::DifferenceEncoding

The difference encoding uses a base encoding that can be overlayed with additional mappings.

See: PDF1.7 s9.6.6.1

Attributes

base_encoding[R]

The base encoding.

Public Class Methods

new(base_encoding) click to toggle source

Initializes the Differences object with the given base encoding object.

Calls superclass method HexaPDF::Font::Encoding::Base::new
# File lib/hexapdf/font/encoding/difference_encoding.rb, line 51
def initialize(base_encoding)
  super()
  @base_encoding = base_encoding
end

Public Instance Methods

code(name) click to toggle source

Returns the code for the given glyph name, either from this object, if a code references the name, or from the base encoding.

# File lib/hexapdf/font/encoding/difference_encoding.rb, line 64
def code(name)
  code_to_name.key(name) || base_encoding.code(name)
end
name(code) click to toggle source

Returns the name for the given code, either from this object, if it contains the code, or from the base encoding.

# File lib/hexapdf/font/encoding/difference_encoding.rb, line 58
def name(code)
  code_to_name[code] || base_encoding.name(code)
end