## Zend_Pdf_Cmap

Description

Abstract helper class for Zend_Pdf_Resource_Font which manages font character maps.

Defines the public interface for concrete subclasses which are responsible for mapping Unicode characters to the font's glyph numbers. Also provides shared utility methods.

Cmap objects should ordinarily be obtained through the factory method cmapWithTypeData().

The supported character map types are those found in the OpenType spec. For additional detail on the internal binary format of these tables, see:

- http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6cmap.html
- http://www.microsoft.com/OpenType/OTSpec/cmap.htm
- http://partners.adobe.com/public/developer/opentype/index_cmap.html

- license: New BSD License
- abstract:
- copyright: Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- todo: Write code for Zend_Pdf_FontCmap_HighByteMapping class.
- todo: Write code for Zend_Pdf_FontCmap_TrimmedArray class.
- todo: Write code for Zend_Pdf_FontCmap_MixedCoverage class.
- todo: Write code for Zend_Pdf_FontCmap_SegmentedCoverage class.

Located in /Zend/Pdf/Cmap.php (line 66)

Direct descendents

Class | Description
--- | ---
Zend_Pdf_Cmap_ByteEncoding | Implements the "byte encoding" character map (type 0).
Zend_Pdf_Cmap_SegmentToDelta | Implements the "segment mapping to delta values" character map (type 4).
Zend_Pdf_Cmap_TrimmedTable | Implements the "trimmed table mapping" character map (type 6).

Class Constant Summary
MISSING_CHARACTER_GLYPH = 0x00
TYPE_BYTE_ENCODING = 0x00
TYPE_BYTE_ENCODING_STATIC = 0xf1
TYPE_HIGH_BYTE_MAPPING = 0x02
TYPE_MIXED_COVERAGE = 0x08
TYPE_SEGMENTED_COVERAGE = 0x0c
TYPE_SEGMENT_TO_DELTA = 0x04
TYPE_TRIMMED_ARRAY = 0x0a
TYPE_TRIMMED_TABLE = 0x06
TYPE_UNKNOWN = 0xff
Method Summary
static Zend_Pdf_Cmap cmapWithTypeData (integer $cmapType, mixed $cmapData)
array getCoveredCharacters ()
integer glyphNumberForCharacter (integer $characterCode)
array glyphNumbersForCharacters (array $characterCodes)
Zend_Pdf_Cmap __construct (string $cmapData)
integer _extractInt2 (string &$data, integer $index)
integer _extractUInt2 (string &$data, integer $index)
integer _extractUInt4 (string &$data, integer $index)
Methods
static cmapWithTypeData (line 158)

Instantiates the appropriate concrete subclass based on the type of cmap table and returns the instance.

The cmap type must be one of the following values:

- Zend_Pdf_Cmap::TYPE_BYTE_ENCODING
- Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC
- Zend_Pdf_Cmap::TYPE_HIGH_BYTE_MAPPING
- Zend_Pdf_Cmap::TYPE_SEGMENT_TO_DELTA
- Zend_Pdf_Cmap::TYPE_TRIMMED_TABLE
- Zend_Pdf_Cmap::TYPE_MIXED_COVERAGE
- Zend_Pdf_Cmap::TYPE_TRIMMED_ARRAY
- Zend_Pdf_Cmap::TYPE_SEGMENTED_COVERAGE

Throws an exception if the table type is invalid or the cmap table data cannot be validated.

- access: public
- throws: Zend_Pdf_Exception

static Zend_Pdf_Cmap cmapWithTypeData (integer $cmapType, mixed $cmapData)

- integer $cmapType: Type of cmap.
- mixed $cmapData: Cmap table data. Usually a string or array.

getCoveredCharacters (line 242)

Returns an array containing the Unicode characters that have entries in this character map.

- return: Unicode character codes.
- access: public
- abstract:

array getCoveredCharacters ()

Redefined in descendants as:

- Zend_Pdf_Cmap_ByteEncoding::getCoveredCharacters() : Returns an array containing the Unicode characters that have entries in this character map.
- Zend_Pdf_Cmap_SegmentToDelta::getCoveredCharacters() : Returns an array containing the Unicode characters that have entries in this character map.
- Zend_Pdf_Cmap_TrimmedTable::getCoveredCharacters() : Returns an array containing the Unicode characters that have entries in this character map.

glyphNumberForCharacter (line 234)

Returns the glyph number corresponding to the Unicode character.

If a particular character doesn't exist in this font, the special 'missing character glyph' will be substituted.

See also glyphNumbersForCharacters() which is optimized for bulk operations.

- return: Glyph number.
- access: public
- abstract:

integer glyphNumberForCharacter (integer $characterCode)

- integer $characterCode: Unicode character code (code point).

Redefined in descendants as:

- Zend_Pdf_Cmap_ByteEncoding::glyphNumberForCharacter() : Returns the glyph number corresponding to the Unicode character.
- Zend_Pdf_Cmap_SegmentToDelta::glyphNumberForCharacter() : Returns the glyph number corresponding to the Unicode character.
- Zend_Pdf_Cmap_TrimmedTable::glyphNumberForCharacter() : Returns the glyph number corresponding to the Unicode character.

glyphNumbersForCharacters (line 220)

Returns an array of glyph numbers corresponding to the Unicode characters.

If a particular character doesn't exist in this font, the special 'missing character glyph' will be substituted.

See also glyphNumberForCharacter().

- return: Array of glyph numbers.
- access: public
- abstract:

array glyphNumbersForCharacters (array $characterCodes)

- array $characterCodes: Array of Unicode character codes (code points).

Redefined in descendants as:

- Zend_Pdf_Cmap_ByteEncoding::glyphNumbersForCharacters() : Returns an array of glyph numbers corresponding to the Unicode characters.
- Zend_Pdf_Cmap_SegmentToDelta::glyphNumbersForCharacters() : Returns an array of glyph numbers corresponding to the Unicode characters.
- Zend_Pdf_Cmap_TrimmedTable::glyphNumbersForCharacters() : Returns an array of glyph numbers corresponding to the Unicode characters.

Constructor __construct (line 207)

Object constructor

Parses the raw binary table data. Throws an exception if the table is malformed.

- access: public
- abstract:
- throws: Zend_Pdf_Exception

Zend_Pdf_Cmap __construct (string $cmapData)

- string $cmapData: Raw binary cmap table data.

Redefined in descendants as:

- Zend_Pdf_Cmap_ByteEncoding::__construct() : Object constructor
- Zend_Pdf_Cmap_ByteEncoding_Static::__construct() : Object constructor
- Zend_Pdf_Cmap_SegmentToDelta::__construct() : Object constructor
- Zend_Pdf_Cmap_TrimmedTable::__construct() : Object constructor

_extractInt2 (line 262)

Extracts a signed 2-byte integer from a string.

Integers are always big-endian. Throws an exception if the index is out of range.

- access: protected
- throws: Zend_Pdf_Exception

integer _extractInt2 (string &$data, integer $index)

- string &$data
- integer $index: Position in string of integer.

_extractUInt2 (line 288)

Extracts an unsigned 2-byte integer from a string.

Integers are always big-endian. Throws an exception if the index is out of range.

- access: protected
- throws: Zend_Pdf_Exception

integer _extractUInt2 (string &$data, integer $index)

- string &$data
- integer $index: Position in string of integer.

_extractUInt4 (line 314)

Extracts an unsigned 4-byte integer from a string.

Integers are always big-endian. Throws an exception if the index is out of range.

NOTE: If you ask for a 4-byte unsigned integer on a 32-bit machine, the resulting value WILL BE SIGNED because PHP uses signed integers internally for everything. To guarantee portability, be sure to use bitwise or similar operators on large integers!

- access: protected
- throws: Zend_Pdf_Exception

integer _extractUInt4 (string &$data, integer $index)

- string &$data
- integer $index: Position in string of integer.

Class Constants
MISSING_CHARACTER_GLYPH = 0x00 (line 125)

Glyph representing missing characters.

TYPE_BYTE_ENCODING = 0x00 (line 76)

Byte Encoding character map table type.

TYPE_BYTE_ENCODING_STATIC = 0xf1 (line 112)

Static Byte Encoding character map table type. Variant of TYPE_BYTEENCODING.

TYPE_HIGH_BYTE_MAPPING = 0x02 (line 81)

High Byte Mapping character map table type.

TYPE_MIXED_COVERAGE = 0x08 (line 96)

Mixed Coverage character map table type.

TYPE_SEGMENTED_COVERAGE = 0x0c (line 106)

Segmented Coverage character map table type.

TYPE_SEGMENT_TO_DELTA = 0x04 (line 86)

Segment Value to Delta Mapping character map table type.

TYPE_TRIMMED_ARRAY = 0x0a (line 101)

Trimmed Array character map table type.

TYPE_TRIMMED_TABLE = 0x06 (line 91)

Trimmed Table character map table type.

TYPE_UNKNOWN = 0xff (line 117)

Unknown character map table type.

Documentation generated on Wed, 21 Feb 2007 11:46:19 -0800 by phpDocumentor 1.3.1