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
Returns the value of attribute map.
Instance Method Summary collapse
-
#decode(c) ⇒ Object
Convert a glyph code into one or more Codepoints.
-
#initialize(data) ⇒ CMap
constructor
A new instance of CMap.
- #size ⇒ Object
Constructor Details
#initialize(data) ⇒ CMap
Returns a new instance of CMap.
51 52 53 54 |
# File 'lib/pdf/reader/cmap.rb', line 51 def initialize(data) @map = {} process_data(data) end |
Instance Attribute Details
#map ⇒ Object (readonly)
Returns the value of attribute map.
49 50 51 |
# File 'lib/pdf/reader/cmap.rb', line 49 def map @map end |
Instance Method Details
#decode(c) ⇒ Object
Convert a glyph code into one or more Codepoints.
Returns an array of Integers.
64 65 66 |
# File 'lib/pdf/reader/cmap.rb', line 64 def decode(c) @map.fetch(c, []) end |
#size ⇒ Object
56 57 58 |
# File 'lib/pdf/reader/cmap.rb', line 56 def size @map.size end |