API Documentation

Pdf/Cmap.php

Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Pdf
subpackage
Fonts
version
$Id: Cmap.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_Pdf_Cmap

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Pdf_Cmap

copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Pdf
subpackage
Fonts
todo
Write code for Zend_Pdf_FontCmap_HighByteMapping class.
todo
Write code for Zend_Pdf_FontCmap_MixedCoverage class.
todo
Write code for Zend_Pdf_FontCmap_TrimmedArray class.
todo
Write code for Zend_Pdf_FontCmap_SegmentedCoverage class.
Constants
TYPE_BYTE_ENCODING
TYPE_HIGH_BYTE_MAPPING
TYPE_SEGMENT_TO_DELTA
TYPE_TRIMMED_TABLE
TYPE_MIXED_COVERAGE
TYPE_TRIMMED_ARRAY
TYPE_SEGMENTED_COVERAGE
TYPE_BYTE_ENCODING_STATIC
TYPE_UNKNOWN
MISSING_CHARACTER_GLYPH
Methods
cmapWithTypeData
__construct
glyphNumbersForCharacters
glyphNumberForCharacter
getCoveredCharacters
getCoveredCharactersGlyphs
_extractInt2
_extractUInt2
_extractUInt4

Description

Abstract helper class for {@link 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 {@link 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:

  • {@link http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6cmap.html}
  • {@link http://www.microsoft.com/OpenType/OTSpec/cmap.htm}
  • {@link http://partners.adobe.com/public/developer/opentype/index_cmap.html}

Constants

TYPE_BYTE_ENCODING

 TYPE_BYTE_ENCODING = '0x00'

Byte Encoding character map table type.

Details

value
0x00

TYPE_HIGH_BYTE_MAPPING

 TYPE_HIGH_BYTE_MAPPING = '0x02'

High Byte Mapping character map table type.

Details

value
0x02

TYPE_SEGMENT_TO_DELTA

 TYPE_SEGMENT_TO_DELTA = '0x04'

Segment Value to Delta Mapping character map table type.

Details

value
0x04

TYPE_TRIMMED_TABLE

 TYPE_TRIMMED_TABLE = '0x06'

Trimmed Table character map table type.

Details

value
0x06

TYPE_MIXED_COVERAGE

 TYPE_MIXED_COVERAGE = '0x08'

Mixed Coverage character map table type.

Details

value
0x08

TYPE_TRIMMED_ARRAY

 TYPE_TRIMMED_ARRAY = '0x0a'

Trimmed Array character map table type.

Details

value
0x0a

TYPE_SEGMENTED_COVERAGE

 TYPE_SEGMENTED_COVERAGE = '0x0c'

Segmented Coverage character map table type.

Details

value
0x0c

TYPE_BYTE_ENCODING_STATIC

 TYPE_BYTE_ENCODING_STATIC = '0xf1'

Static Byte Encoding character map table type. Variant of {@link TYPE_BYTEENCODING}.

Details

value
0xf1

TYPE_UNKNOWN

 TYPE_UNKNOWN = '0xff'

Unknown character map table type.

Details

value
0xff

MISSING_CHARACTER_GLYPH

 MISSING_CHARACTER_GLYPH = '0x00'

Glyph representing missing characters.

Details

value
0x00

Methods

__construct

__construct( string $cmapData ) :

Object constructor

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

Arguments
$cmapData
string
Raw binary cmap table data.
Details
visibility
public
final
false
static
false
throws

_extractInt2

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

Extracts a signed 2-byte integer from a string.

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

Arguments
$data
string
&$data
$index
integer
Position in string of integer.
Output
integer
Details
visibility
protected
final
false
static
false
throws

_extractUInt2

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

Extracts an unsigned 2-byte integer from a string.

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

Arguments
$data
string
&$data
$index
integer
Position in string of integer.
Output
integer
Details
visibility
protected
final
false
static
false
throws

_extractUInt4

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

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!

Arguments
$data
string
&$data
$index
integer
Position in string of integer.
Output
integer
Details
visibility
protected
final
false
static
false
throws

cmapWithTypeData

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

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:

  • {@link Zend_Pdf_Cmap::TYPE_BYTE_ENCODING}
  • {@link Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC}
  • {@link Zend_Pdf_Cmap::TYPE_HIGH_BYTE_MAPPING}
  • {@link Zend_Pdf_Cmap::TYPE_SEGMENT_TO_DELTA}
  • {@link Zend_Pdf_Cmap::TYPE_TRIMMED_TABLE}
  • {@link Zend_Pdf_Cmap::TYPE_MIXED_COVERAGE}
  • {@link Zend_Pdf_Cmap::TYPE_TRIMMED_ARRAY}
  • {@link Zend_Pdf_Cmap::TYPE_SEGMENTED_COVERAGE}

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

Arguments
$cmapType
integer
Type of cmap.
$cmapData
mixed
Cmap table data. Usually a string or array.
Output
Zend_Pdf_Cmap
Details
visibility
public
final
false
static
true
throws

getCoveredCharacters

getCoveredCharacters( ) : array

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

Output
array
Unicode character codes.
Details
visibility
public
final
false
static
false

getCoveredCharactersGlyphs

getCoveredCharactersGlyphs( ) : array

Returns an array containing the glyphs numbers that have entries in this character map.

Keys are Unicode character codes (integers)

This functionality is partially covered by glyphNumbersForCharacters(getCoveredCharacters()) call, but this method do it in more effective way (prepare complete list instead of searching glyph for each character code).

Output
array
Array representing <Unicode character code> => <glyph number> pairs.
Details
visibility
public
final
false
static
false
internal

glyphNumberForCharacter

glyphNumberForCharacter( integer $characterCode ) : integer

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 {@link glyphNumbersForCharacters()} which is optimized for bulk operations.

Arguments
$characterCode
integer
Unicode character code (code point).
Output
integer
Glyph number.
Details
visibility
public
final
false
static
false

glyphNumbersForCharacters

glyphNumbersForCharacters( array $characterCodes ) : array

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 {@link glyphNumberForCharacter()}.

Arguments
$characterCodes
array
Array of Unicode character codes (code points).
Output
array
Array of glyph numbers.
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.