Class: PDF::Reader::CMap

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#mapObject (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

#sizeObject



56
57
58
# File 'lib/pdf/reader/cmap.rb', line 56

def size
  @map.size
end