Pdf/Cmap.php

Show: PublicProtectedPrivateinherited
Table of Contents
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.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Pdf  
Subpackage
Fonts  
Version
$Id$  

\Zend_Pdf_Cmap

Package: Zend_Pdf\Fonts
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}
Children
\Zend_Pdf_Cmap_ByteEncoding
\Zend_Pdf_Cmap_TrimmedTable
\Zend_Pdf_Cmap_SegmentToDelta
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
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

>VConstant  TYPE_BYTE_ENCODING = 0
Byte Encoding character map table type.
>VConstant  TYPE_HIGH_BYTE_MAPPING = 2
High Byte Mapping character map table type.
>VConstant  TYPE_SEGMENT_TO_DELTA = 4
Segment Value to Delta Mapping character map table type.
>VConstant  TYPE_TRIMMED_TABLE = 6
Trimmed Table character map table type.
>VConstant  TYPE_MIXED_COVERAGE = 8
Mixed Coverage character map table type.
>VConstant  TYPE_TRIMMED_ARRAY = 10
Trimmed Array character map table type.
>VConstant  TYPE_SEGMENTED_COVERAGE = 12
Segmented Coverage character map table type.
>VConstant  TYPE_BYTE_ENCODING_STATIC = 241
Static Byte Encoding character map table type. Variant of {@link TYPE_BYTEENCODING}.
>VConstant  TYPE_UNKNOWN = 255
Unknown character map table type.
>VConstant  MISSING_CHARACTER_GLYPH = 0
Glyph representing missing characters.

Methods

methodpublic__construct(string $cmapData) : void
abstract

Object constructor

Parses the raw binary table data. Throws an exception if the table is malformed.
Parameters
NameTypeDescription
$cmapDatastring

Raw binary cmap table data.

Throws
ExceptionDescription
\Zend_Pdf_Exception
methodprotected_extractInt2( $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.
Parameters
NameTypeDescription
$data
$indexinteger

Position in string of integer.

Returns
TypeDescription
integer
Throws
ExceptionDescription
\Zend_Pdf_Exception
methodprotected_extractUInt2( $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.
Parameters
NameTypeDescription
$data
$indexinteger

Position in string of integer.

Returns
TypeDescription
integer
Throws
ExceptionDescription
\Zend_Pdf_Exception
methodprotected_extractUInt4( $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!
Parameters
NameTypeDescription
$data
$indexinteger

Position in string of integer.

Returns
TypeDescription
integer
Throws
ExceptionDescription
\Zend_Pdf_Exception
methodpubliccmapWithTypeData(integer $cmapType, mixed $cmapData) : \Zend_Pdf_Cmap
static

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.
Parameters
NameTypeDescription
$cmapTypeinteger

Type of cmap.

$cmapDatamixed

Cmap table data. Usually a string or array.

Returns
TypeDescription
\Zend_Pdf_Cmap
Throws
ExceptionDescription
\Zend_Pdf_Exception
methodpublicgetCoveredCharacters() : array
abstract

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

Returns
TypeDescription
arrayUnicode character codes.
methodpublicglyphNumberForCharacter(integer $characterCode) : integer
abstract

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.
Parameters
NameTypeDescription
$characterCodeinteger

Unicode character code (code point).

Returns
TypeDescription
integerGlyph number.
methodpublicglyphNumbersForCharacters(array $characterCodes) : array
abstract

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()}.
Parameters
NameTypeDescription
$characterCodesarray

Array of Unicode character codes (code points).

Returns
TypeDescription
arrayArray of glyph numbers.
Documentation was generated by phpDocumentor 2.2.0 .