SetaPDF_Core_Font_Cmap Class representing a CMAP.

File: /SetaPDF/Core/Font/Cmap.php

This class includes a very simple parser for CID data. The extracted data are limited to unicode and cid mappings.

Class hierarchy

Implements

Summary

Static Properties

$namedInstances

static public array SetaPDF_Core_Font_Cmap::$namedInstances = array()

Cache for named instances.


Properties

$_cidMap

A separate CMAP instance of only CID mappings.

$_codeSpaceRanges

protected array SetaPDF_Core_Font_Cmap::$_codeSpaceRanges = array()

Code space ranges.

$_lookUps

protected array SetaPDF_Core_Font_Cmap::$_lookUps = array(...)

Resolved data for an optimization of a reverse lookup.

$_mappings

protected array SetaPDF_Core_Font_Cmap::$_mappings = array(...)

CID and uncidoe mappings.

$_name

protected string SetaPDF_Core_Font_Cmap::$_name

The name resolved from the CMAP file.


Static Methods

_checkForCMapInstance()

static protected bool SetaPDF_Core_Font_Cmap::_checkForCMapInstance ( mixed $cmap )

Helper method that throws an exception if the given parameter is not an instance of self.

Parameters
$cmap : mixed
 
Exceptions

Throws SetaPDF_Core_Font_Exception

_readValue()

static protected array|string SetaPDF_Core_Font_Cmap::_readValue ( SetaPDF_Core_Tokenizer $tokenizer )

Read the next value via the tokenizer instance.

Parameters
$tokenizer : SetaPDF_Core_Tokenizer
 

cleanUpNamedInstanceCache()

static public void SetaPDF_Core_Font_Cmap::cleanUpNamedInstanceCache ( [ string|null $name = null ] )

Remove named cmap instances from the local cache.

Parameters
$name : string|null

The name or null for all cached instances

create()

static public null|SetaPDF_Core_Font_Cmap SetaPDF_Core_Font_Cmap::create ( SetaPDF_Core_Reader_ReaderInterface $reader )

Create an instance based on CMAP data through an reader instance.

Parameters
$reader : SetaPDF_Core_Reader_ReaderInterface
 

createNamed()

static public mixed|null|SetaPDF_Core_Font_Cmap SetaPDF_Core_Font_Cmap::createNamed ( $name $name [, bool $cache = false ] )

Creates an instance of an existing CMAP.

Existing CMAPs can be found in /SetaPDF/Font/Cmap/_cmaps/. A named instance will be cached. To remove it from memory you will need to call SetaPDF_Core_Font_Cmap::cleanUpNamedInstanceCache().

Parameters
$name : $name
 
$cache : bool
 

Methods

_lookup()

protected bool|number|string SetaPDF_Core_Font_Cmap::_lookup ( string $type, string $src )

Lookup by a type.

Parameters
$type : string
 
$src : string
 

_reverseLookup()

protected bool|number|string SetaPDF_Core_Font_Cmap::_reverseLookup ( string $dest, string $type )

Do a reverse lookup by a specific type.

Parameters
$dest : string
 
$type : string
 

addCidRangeMapping()

public void SetaPDF_Core_Font_Cmap::addCidRangeMapping ( integer $src1, integer $src2, string $dst, integer $size )

Add a cid range mapping.

Parameters
$src1 : integer
 
$src2 : integer
 
$dst : string
 
$size : integer
 

addCidSingleMapping()

public void SetaPDF_Core_Font_Cmap::addCidSingleMapping ( string $src, string $dst )

Add a single cid mapping.

Parameters
$src : string
 
$dst : string
 

addCodeSpaceRange()

public void SetaPDF_Core_Font_Cmap::addCodeSpaceRange ( string $start, string $end )

Add a codespace range.

Parameters
$start : string
 
$end : string
 

addRangeMapping()

public void SetaPDF_Core_Font_Cmap::addRangeMapping ( integer $src1, integer $src2, string $dst, integer $size )

Add a range mapping.

Parameters
$src1 : integer
 
$src2 : integer
 
$dst : string
 
$size : integer
 

addSingleMapping()

public void SetaPDF_Core_Font_Cmap::addSingleMapping ( string $src, string $dst )

Add a single mapping.

Parameters
$src : string
 
$dst : string
 

getCidMap()

public SetaPDF_Core_Font_Cmap SetaPDF_Core_Font_Cmap::getCidMap ( void )

Get the separate CID Map.

getName()

public string SetaPDF_Core_Font_Cmap::getName ( void )

Get the name of the CID map.

lookup()

public bool|number|string SetaPDF_Core_Font_Cmap::lookup ( string $src )

Lookup a unicode value.

Parameters
$src : string
 

lookupCid()

public bool|number|string SetaPDF_Core_Font_Cmap::lookupCid ( string $src )

Lookup for a CID.

Parameters
$src : string
 

reverseCidLoopkup()

public bool|mixed SetaPDF_Core_Font_Cmap::reverseCidLoopkup ( string $dest )

Do a reverse CID lookup.

Parameters
$dest : string
 

reverseLookup()

public bool|mixed SetaPDF_Core_Font_Cmap::reverseLookup ( string $dest )

Do a reverse lookup.

Parameters
$dest : string
 

setCidMap()

public void SetaPDF_Core_Font_Cmap::setCidMap ( SetaPDF_Core_Font_Cmap $cidMap )

Set the CID map instance.

Parameters
$cidMap : SetaPDF_Core_Font_Cmap