Method: PDF::Reader::Encoding#differences=

Defined in:
lib/pdf/reader/encoding.rb

#differences=(diff) ⇒ Object

set the differences table for this encoding. should be an array in the following format:

[25, :A, 26, :B]

The array alternates between a decimal byte number and a glyph name to map to that byte

To save space the following array is also valid and equivalent to the previous one

[25, :A, :B]

Raises:

  • (ArgumentError)


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/pdf/reader/encoding.rb', line 67

def differences=(diff)
  raise ArgumentError, "diff must be an array" unless diff.kind_of?(Array)

  @differences = {}
  byte = 0
  diff.each do |val|
    if val.kind_of?(Numeric)
      byte = val.to_i
    else
      @differences[byte] = val
      @mapping[byte] = glyphlist.name_to_unicode(val)
      byte += 1
    end
  end
  @differences
end