Class: PDF::Reader::CMap
- Inherits:
-
Object
- Object
- PDF::Reader::CMap
- Defined in:
- lib/pdf/reader/cmap.rb
Overview
wraps a string containing a PDF CMap and provides convenience methods for extracting various useful information.
Constant Summary collapse
- CMAP_KEYWORDS =
:nodoc:
{ "begincodespacerange" => :noop, "endcodespacerange" => :noop, "beginbfchar" => :noop, "endbfchar" => :noop, "beginbfrange" => :noop, "endbfrange" => :noop, "begin" => :noop, "begincmap" => :noop, "def" => :noop }
Instance Attribute Summary collapse
-
#map ⇒ Object
readonly
: Hash[Integer, Array].
Instance Method Summary collapse
-
#decode(c) ⇒ Object
Convert a glyph code into one or more Codepoints.
-
#initialize(data) ⇒ CMap
constructor
: (String) -> void.
-
#size ⇒ Object
: () -> Integer.
Constructor Details
#initialize(data) ⇒ CMap
: (String) -> void
53 54 55 56 |
# File 'lib/pdf/reader/cmap.rb', line 53 def initialize(data) @map = {} #: Hash[Integer, Array[Integer]] process_data(data) end |
Instance Attribute Details
#map ⇒ Object (readonly)
: Hash[Integer, Array]
50 51 52 |
# File 'lib/pdf/reader/cmap.rb', line 50 def map @map end |
Instance Method Details
#decode(c) ⇒ Object
Convert a glyph code into one or more Codepoints.
Returns an array of Integers.
: (Integer) -> Array
68 69 70 |
# File 'lib/pdf/reader/cmap.rb', line 68 def decode(c) @map.fetch(c, []) end |
#size ⇒ Object
: () -> Integer
59 60 61 |
# File 'lib/pdf/reader/cmap.rb', line 59 def size @map.size end |