Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions
Zend_Pdf_Cmap Class Reference
Inheritance diagram for Zend_Pdf_Cmap:
Zend_Pdf_Cmap_ByteEncoding Zend_Pdf_Cmap_SegmentToDelta Zend_Pdf_Cmap_TrimmedTable Zend_Pdf_Cmap_ByteEncoding_Static

Public Member Functions

 __construct ($cmapData)
 
 glyphNumbersForCharacters ($characterCodes)
 
 glyphNumberForCharacter ($characterCode)
 
 getCoveredCharacters ()
 
 getCoveredCharactersGlyphs ()
 

Static Public Member Functions

static cmapWithTypeData ($cmapType, $cmapData)
 

Data Fields

const TYPE_BYTE_ENCODING = 0x00
 
const TYPE_HIGH_BYTE_MAPPING = 0x02
 
const TYPE_SEGMENT_TO_DELTA = 0x04
 
const TYPE_TRIMMED_TABLE = 0x06
 
const TYPE_MIXED_COVERAGE = 0x08
 
const TYPE_TRIMMED_ARRAY = 0x0a
 
const TYPE_SEGMENTED_COVERAGE = 0x0c
 
const TYPE_BYTE_ENCODING_STATIC = 0xf1
 
const TYPE_UNKNOWN = 0xff
 
const MISSING_CHARACTER_GLYPH = 0x00
 

Protected Member Functions

 _extractInt2 (&$data, $index)
 
 _extractUInt2 (&$data, $index)
 
 _extractUInt4 (&$data, $index)
 

Detailed Description

Definition at line 53 of file Cmap.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $cmapData)
abstract

Object constructor

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

Parameters
string$cmapDataRaw binary cmap table data.
Exceptions
Zend_Pdf_Exception

Member Function Documentation

◆ _extractInt2()

_extractInt2 ( $data,
  $index 
)
protected

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
string&$data
integer$indexPosition in string of integer.
Returns
integer
Exceptions
Zend_Pdf_Exception

Definition at line 270 of file Cmap.php.

271  {
272  if (($index < 0) | (($index + 1) > strlen($data))) {
273  #require_once 'Zend/Pdf/Exception.php';
274  throw new Zend_Pdf_Exception("Index out of range: $index",
276  }
277  $number = ord($data[$index]);
278  if (($number & 0x80) == 0x80) { // negative
279  $number = ~((((~ $number) & 0xff) << 8) | ((~ ord($data[++$index])) & 0xff));
280  } else {
281  $number = ($number << 8) | ord($data[++$index]);
282  }
283  return $number;
284  }
$number
Definition: details.phtml:22
const INDEX_OUT_OF_RANGE
Definition: Exception.php:100
$index
Definition: list.phtml:44

◆ _extractUInt2()

_extractUInt2 ( $data,
  $index 
)
protected

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
string&$data
integer$indexPosition in string of integer.
Returns
integer
Exceptions
Zend_Pdf_Exception

Definition at line 297 of file Cmap.php.

298  {
299  if (($index < 0) | (($index + 1) > strlen($data))) {
300  #require_once 'Zend/Pdf/Exception.php';
301  throw new Zend_Pdf_Exception("Index out of range: $index",
303  }
304  $number = (ord($data[$index]) << 8) | ord($data[++$index]);
305  return $number;
306  }
$number
Definition: details.phtml:22
const INDEX_OUT_OF_RANGE
Definition: Exception.php:100
$index
Definition: list.phtml:44

◆ _extractUInt4()

_extractUInt4 ( $data,
  $index 
)
protected

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
string&$data
integer$indexPosition in string of integer.
Returns
integer
Exceptions
Zend_Pdf_Exception

Definition at line 324 of file Cmap.php.

325  {
326  if (($index < 0) | (($index + 3) > strlen($data))) {
327  #require_once 'Zend/Pdf/Exception.php';
328  throw new Zend_Pdf_Exception("Index out of range: $index",
330  }
331  $number = (ord($data[$index]) << 24) | (ord($data[++$index]) << 16) |
332  (ord($data[++$index]) << 8) | ord($data[++$index]);
333  return $number;
334  }
$number
Definition: details.phtml:22
const INDEX_OUT_OF_RANGE
Definition: Exception.php:100
$index
Definition: list.phtml:44

◆ cmapWithTypeData()

static cmapWithTypeData (   $cmapType,
  $cmapData 
)
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:

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

Parameters
integer$cmapTypeType of cmap.
mixed$cmapDataCmap table data. Usually a string or array.
Returns
Zend_Pdf_Cmap
Exceptions
Zend_Pdf_Exception

Definition at line 145 of file Cmap.php.

146  {
147  switch ($cmapType) {
149  #require_once 'Zend/Pdf/Cmap/ByteEncoding.php';
150  return new Zend_Pdf_Cmap_ByteEncoding($cmapData);
151 
153  #require_once 'Zend/Pdf/Cmap/ByteEncoding/Static.php';
154  return new Zend_Pdf_Cmap_ByteEncoding_Static($cmapData);
155 
157  #require_once 'Zend/Pdf/Exception.php';
158  throw new Zend_Pdf_Exception('High byte mapping cmap currently unsupported',
160 
162  #require_once 'Zend/Pdf/Cmap/SegmentToDelta.php';
163  return new Zend_Pdf_Cmap_SegmentToDelta($cmapData);
164 
166  #require_once 'Zend/Pdf/Cmap/TrimmedTable.php';
167  return new Zend_Pdf_Cmap_TrimmedTable($cmapData);
168 
170  #require_once 'Zend/Pdf/Exception.php';
171  throw new Zend_Pdf_Exception('Mixed coverage cmap currently unsupported',
173 
175  #require_once 'Zend/Pdf/Exception.php';
176  throw new Zend_Pdf_Exception('Trimmed array cmap currently unsupported',
178 
180  #require_once 'Zend/Pdf/Exception.php';
181  throw new Zend_Pdf_Exception('Segmented coverage cmap currently unsupported',
183 
184  default:
185  #require_once 'Zend/Pdf/Exception.php';
186  throw new Zend_Pdf_Exception("Unknown cmap type: $cmapType",
188  }
189  }
const TYPE_MIXED_COVERAGE
Definition: Cmap.php:83
const TYPE_BYTE_ENCODING
Definition: Cmap.php:63
const TYPE_TRIMMED_TABLE
Definition: Cmap.php:78
const TYPE_SEGMENTED_COVERAGE
Definition: Cmap.php:93
const TYPE_BYTE_ENCODING_STATIC
Definition: Cmap.php:99
const TYPE_SEGMENT_TO_DELTA
Definition: Cmap.php:73
const TYPE_TRIMMED_ARRAY
Definition: Cmap.php:88
const TYPE_HIGH_BYTE_MAPPING
Definition: Cmap.php:68
const CMAP_TYPE_UNSUPPORTED
Definition: Exception.php:255

◆ getCoveredCharacters()

getCoveredCharacters ( )
abstract

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

Returns
array Unicode character codes.

◆ getCoveredCharactersGlyphs()

getCoveredCharactersGlyphs ( )
abstract

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).

◆ glyphNumberForCharacter()

glyphNumberForCharacter (   $characterCode)
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 glyphNumbersForCharacters() which is optimized for bulk operations.

Parameters
integer$characterCodeUnicode character code (code point).
Returns
integer Glyph number.

◆ glyphNumbersForCharacters()

glyphNumbersForCharacters (   $characterCodes)
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 glyphNumberForCharacter().

Parameters
array$characterCodesArray of Unicode character codes (code points).
Returns
array Array of glyph numbers.

Field Documentation

◆ MISSING_CHARACTER_GLYPH

const MISSING_CHARACTER_GLYPH = 0x00

Glyph representing missing characters.

Definition at line 112 of file Cmap.php.

◆ TYPE_BYTE_ENCODING

const TYPE_BYTE_ENCODING = 0x00

Byte Encoding character map table type.

Definition at line 63 of file Cmap.php.

◆ TYPE_BYTE_ENCODING_STATIC

const TYPE_BYTE_ENCODING_STATIC = 0xf1

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

Definition at line 99 of file Cmap.php.

◆ TYPE_HIGH_BYTE_MAPPING

const TYPE_HIGH_BYTE_MAPPING = 0x02

High Byte Mapping character map table type.

Definition at line 68 of file Cmap.php.

◆ TYPE_MIXED_COVERAGE

const TYPE_MIXED_COVERAGE = 0x08

Mixed Coverage character map table type.

Definition at line 83 of file Cmap.php.

◆ TYPE_SEGMENT_TO_DELTA

const TYPE_SEGMENT_TO_DELTA = 0x04

Segment Value to Delta Mapping character map table type.

Definition at line 73 of file Cmap.php.

◆ TYPE_SEGMENTED_COVERAGE

const TYPE_SEGMENTED_COVERAGE = 0x0c

Segmented Coverage character map table type.

Definition at line 93 of file Cmap.php.

◆ TYPE_TRIMMED_ARRAY

const TYPE_TRIMMED_ARRAY = 0x0a

Trimmed Array character map table type.

Definition at line 88 of file Cmap.php.

◆ TYPE_TRIMMED_TABLE

const TYPE_TRIMMED_TABLE = 0x06

Trimmed Table character map table type.

Definition at line 78 of file Cmap.php.

◆ TYPE_UNKNOWN

const TYPE_UNKNOWN = 0xff

Unknown character map table type.

Definition at line 104 of file Cmap.php.


The documentation for this class was generated from the following file: