## Zend_Pdf_FileParser_Font_OpenType

Description

Abstract base class for OpenType font file parsers.

TrueType was originally developed by Apple and was adopted as the default font format for the Microsoft Windows platform. OpenType is an extension of TrueType, developed jointly by Microsoft and Adobe, which adds support for PostScript font data.

This abstract parser class forms the foundation for concrete subclasses which extract either TrueType or PostScript font data from the file.

All OpenType files use big-endian byte ordering.

The full TrueType and OpenType specifications can be found at:

- http://developer.apple.com/textfonts/TTRefMan/
- http://www.microsoft.com/typography/OTSPEC/
- http://partners.adobe.com/public/developer/opentype/index_spec.html

- abstract:
- license: New BSD License
- copyright: Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Zend/Pdf/FileParser/Font/OpenType.php (line 53)

    Zend_Pdf_FileParser
       |
       --Zend_Pdf_FileParser_Font
          |
          --Zend_Pdf_FileParser_Font_OpenType

Direct descendents

Class | Description
--- | ---
Zend_Pdf_FileParser_Font_OpenType_TrueType | Parses an OpenType font file containing TrueType outlines.

Variable Summary
integer $_scalerType
array $_tableDirectory
Method Summary
void parse ()
void screen ()
void _jumpToTable (string $tableName)
string _languageCodeForPlatform (integer $platformID, $languageID, integer $encodingID)
void _parseCmapTable ()
void _parseHeadTable ()
void _parseHheaTable ()
void _parseHmtxTable ()
void _parseNameTable ()
void _parseOs2Table ()
void _parsePostTable ()
void _parseTableDirectory ()
integer _readScalerType ()
float _readTableVersion (float $minVersion, $maxVersion, float $maxVertion)
Variables
integer $_scalerType = 0 (line 63)

Stores the scaler type (font type) for the font file. See _readScalerType().

- access: protected

array $_tableDirectory = array() (line 69)

Stores the byte offsets to the various information tables.

- access: protected

#### Inherited Variables

Inherited from Zend_Pdf_FileParser

> Zend_Pdf_FileParser::$_dataSource
> Zend_Pdf_FileParser::$_isParsed
> Zend_Pdf_FileParser::$_isScreened

Methods
parse (line 102)

Reads and parses the font data from the file on disk.

NOTE: This method should be overridden in subclasses to add type- specific parsing and set $this->isParsed.

- access: public
- throws: Zend_Pdf_Exception

void parse ()

Redefinition of:

Zend_Pdf_FileParser::parse()
  Reads and parses the complete binary file.

Redefined in descendants as:

- Zend_Pdf_FileParser_Font_OpenType_TrueType::parse() : Reads and parses the TrueType font data from the file on disk.

screen (line 86)

Verifies that the font file is in the expected format.

NOTE: This method should be overridden in subclasses to check the specific format and set $this->_isScreened!

- access: public
- throws: Zend_Pdf_Exception

void screen ()

Redefinition of:

Zend_Pdf_FileParser::screen()
  Performs a cursory check to verify that the binary file is in the expected format. Intended to quickly weed out obviously bogus files.

Redefined in descendants as:

- Zend_Pdf_FileParser_Font_OpenType_TrueType::screen() : Verifies that the font file actually contains TrueType outlines.

_jumpToTable (line 944)

Validates a given table's existence, then sets the file pointer to the start of that table.

- access: protected
- throws: Zend_Pdf_Exception

void _jumpToTable (string $tableName)

- string $tableName

_languageCodeForPlatform (line 984)

Utility method that returns ISO 639 two-letter language codes from the TrueType platform and language ID. Returns NULL for languages that are not supported.

- return: | null
- access: protected

string _languageCodeForPlatform (integer $platformID, $languageID, integer $encodingID)

- integer $platformID
- integer $encodingID
- $languageID

_parseCmapTable (line 741)

Parses the OpenType cmap (Character to Glyph Mapping) table.

The cmap table provides the maps from character codes to font glyphs. There are usually at least two character maps in a font: Microsoft Unicode and Macintosh Roman. For very complex fonts, there may also be mappings for the characters in the Unicode Surrogates Area, which are UCS-4 characters.

- access: protected
- throws: Zend_Pdf_Exception
- todo: Need to rework the selection logic for picking a subtable. We should have an explicit list of preferences, followed by a list of those that are tolerable. Most specifically, since everything above this layer deals in Unicode, we need to be sure to only accept format 0 MacRoman tables.

void _parseCmapTable ()
_parseHeadTable (line 218)

Parses the OpenType head (Font Header) table.

The head table contains global information about the font such as the revision number and global metrics.

- access: protected
- throws: Zend_Pdf_Exception

void _parseHeadTable ()
_parseHheaTable (line 411)

Parses the OpenType hhea (Horizontal Header) table.

The hhea table contains information used for horizontal layout. It also contains some vertical layout information for Apple systems. The vertical layout information for the PDF file is usually taken from the OS/2 table.

- access: protected
- throws: Zend_Pdf_Exception

void _parseHheaTable ()
_parseHmtxTable (line 691)

Parses the OpenType hmtx (Horizontal Metrics) table.

The hmtx table contains the horizontal metrics for every glyph contained within the font. These are the critical values for horizontal layout of text.

- access: protected
- throws: Zend_Pdf_Exception

void _parseHmtxTable ()
_parseNameTable (line 279)

Parses the OpenType name (Naming) table.

The name table contains all of the identifying strings associated with the font such as its name, copyright, trademark, license, etc.

- access: protected
- throws: Zend_Pdf_Exception

void _parseNameTable ()
_parseOs2Table (line 463)

Parses the OpenType OS/2 (OS/2 and Windows Metrics) table.

The OS/2 table contains additional metrics data that is required to use the font on the OS/2 or Microsoft Windows platforms. It is not required for Macintosh fonts, so may not always be present. When available, we use this table to determine most of the vertical layout and stylistic information and for the font.

- access: protected
- throws: Zend_Pdf_Exception

void _parseOs2Table ()
_parsePostTable (line 374)

Parses the OpenType post (PostScript Information) table.

The post table contains additional information required for using the font on PostScript printers. It also contains the preferred location and thickness for an underline, which is used by our layout code.

- access: protected
- throws: Zend_Pdf_Exception

void _parsePostTable ()
_parseTableDirectory (line 150)

Parses the OpenType table directory.

The table directory contains the identifier, checksum, byte offset, and length of each of the information tables housed in the font file.

- access: protected
- throws: Zend_Pdf_Exception

void _parseTableDirectory ()
_readScalerType (line 903)

Reads the scaler type from the header of the OpenType font file and returns it as an unsigned long integer.

The scaler type defines the type of font: OpenType font files may contain TrueType or PostScript outlines. Throws an exception if the scaler type is not recognized.

- access: protected
- throws: Zend_Pdf_Exception

integer _readScalerType ()
_readTableVersion (line 964)

Reads the fixed 16.16 table version number and checks for compatibility.

If the version is incompatible, throws an exception. If it is compatible, returns the version number.

- return: Table version number.
- access: protected
- throws: Zend_Pdf_Exception

float _readTableVersion (float $minVersion, $maxVersion, float $maxVertion)

- float $minVersion: Minimum compatible version number.
- float $maxVertion: Maximum compatible version number.
- $maxVersion

#### Inherited Methods

Inherited From Zend_Pdf_FileParser_Font

> Zend_Pdf_FileParser_Font::__construct()
> Zend_Pdf_FileParser_Font::readStringMacRoman()
> Zend_Pdf_FileParser_Font::readStringPascal()
> Zend_Pdf_FileParser_Font::readStringUTF16()
> Zend_Pdf_FileParser_Font::writeDebug()
> Zend_Pdf_FileParser_Font::_debugLog()
> Zend_Pdf_FileParser_Font::__get()
> Zend_Pdf_FileParser_Font::__set()

Inherited From Zend_Pdf_FileParser

> Zend_Pdf_FileParser::__construct()
> Zend_Pdf_FileParser::getDataSource()
> Zend_Pdf_FileParser::isBitSet()
> Zend_Pdf_FileParser::isParsed()
> Zend_Pdf_FileParser::isScreened()
> Zend_Pdf_FileParser::moveToOffset()
> Zend_Pdf_FileParser::parse()
> Zend_Pdf_FileParser::readBytes()
> Zend_Pdf_FileParser::readFixed()
> Zend_Pdf_FileParser::readInt()
> Zend_Pdf_FileParser::readStringMacRoman()
> Zend_Pdf_FileParser::readStringPascal()
> Zend_Pdf_FileParser::readStringUTF16()
> Zend_Pdf_FileParser::readUInt()
> Zend_Pdf_FileParser::screen()
> Zend_Pdf_FileParser::skipBytes()
> Zend_Pdf_FileParser::__destruct()

Class Constants

#### Inherited Constants

Inherited from Zend_Pdf_FileParser

> Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN
> Zend_Pdf_FileParser::BYTE_ORDER_LITTLE_ENDIAN

Documentation generated on Wed, 21 Feb 2007 11:55:50 -0800 by phpDocumentor 1.3.1