Class: HexaPDF::Font::Encoding::DifferenceEncoding
- Defined in:
- lib/hexapdf/font/encoding/difference_encoding.rb
Overview
The difference encoding uses a base encoding that can be overlayed with additional mappings.
See: PDF2.0 s9.6.5.1
Instance Attribute Summary collapse
-
#base_encoding ⇒ Object
readonly
The base encoding.
Attributes inherited from Base
Instance Method Summary collapse
-
#code(name) ⇒ Object
Returns the code for the given glyph name, either from this object, if a code references the name, or from the base encoding.
-
#initialize(base_encoding) ⇒ DifferenceEncoding
constructor
Initializes the Differences object with the given base encoding object.
-
#name(code) ⇒ Object
Returns the name for the given code, either from this object, if it contains the code, or from the base encoding.
Methods inherited from Base
Constructor Details
#initialize(base_encoding) ⇒ DifferenceEncoding
Initializes the Differences object with the given base encoding object.
52 53 54 55 |
# File 'lib/hexapdf/font/encoding/difference_encoding.rb', line 52 def initialize(base_encoding) super() @base_encoding = base_encoding end |
Instance Attribute Details
#base_encoding ⇒ Object (readonly)
The base encoding.
49 50 51 |
# File 'lib/hexapdf/font/encoding/difference_encoding.rb', line 49 def base_encoding @base_encoding end |
Instance Method Details
#code(name) ⇒ Object
Returns the code for the given glyph name, either from this object, if a code references the name, or from the base encoding.
65 66 67 |
# File 'lib/hexapdf/font/encoding/difference_encoding.rb', line 65 def code(name) code_to_name.key(name) || base_encoding.code(name) end |
#name(code) ⇒ Object
Returns the name for the given code, either from this object, if it contains the code, or from the base encoding.
59 60 61 |
# File 'lib/hexapdf/font/encoding/difference_encoding.rb', line 59 def name(code) code_to_name[code] || base_encoding.name(code) end |