Class: I2CE FontMetricTTF: Difference between revisions
No edit summary |
No edit summary |
||
Line 43: | Line 43: | ||
===__construct()=== | ===__construct()=== | ||
*Signature: public function __construct($encoding,$ttf_file) | *Signature: public function __construct($encoding,$ttf_file) | ||
Parameters: | *Parameters: | ||
*&$encoding | **&$encoding | ||
*$ttf_file | *$ttf_file | ||
===close()=== | ===close()=== | ||
Line 50: | Line 50: | ||
===generate_PDF_CMAP()=== | ===generate_PDF_CMAP()=== | ||
*Signature: public function generate_PDF_CMAP($platform_id,$platform_specific_id) | *Signature: public function generate_PDF_CMAP($platform_id,$platform_specific_id) | ||
Parameters: | *Parameters: | ||
*$platform_id | *$platform_id | ||
**Default Value: null | ***Default Value: null | ||
*$platform_specific_id | *$platform_specific_id | ||
**Default Value: null | ***Default Value: null | ||
===getCIDtoGIDmap()=== | ===getCIDtoGIDmap()=== | ||
$param int $platform_id is the Platform ID. Default is null which means we dont care. | $param int $platform_id is the Platform ID. Default is null which means we dont care. The platform ID follows this table <table> <tr><td>Platform ID</td><td> Platform </td><td>Specific encoding</td></tr> <tr><td>0</td><td> Unicode </td><td>Indicates Unicode version.</td></tr> <tr><td>1</td><td> Macintosh </td><td>Script Manager code.</td></tr> <tr><td>3</td><td> Microsoft</td><td> Microsoft encoding.</td></tr></table> | ||
The platform ID follows this table | |||
<table> <tr><td>Platform ID</td><td> Platform </td><td>Specific encoding</td></tr> | |||
<tr><td>0</td><td> Unicode </td><td>Indicates Unicode version.</td></tr> | |||
<tr><td>1</td><td> Macintosh </td><td>Script Manager code.</td></tr> | |||
<tr><td>3</td><td> Microsoft</td><td> Microsoft encoding.</td></tr></table> | |||
*Signature: public function getCIDtoGIDmap($platform_id,$platform_specific_id) | *Signature: public function getCIDtoGIDmap($platform_id,$platform_specific_id) | ||
Parameters: | *Parameters: | ||
*$platform_id | *$platform_id | ||
**Default Value: null | ***Default Value: null | ||
* [http://www.php.net/manual/en/language.types.integer.php int ] $platform_specific_id | ** [http://www.php.net/manual/en/language.types.integer.php int ] $platform_specific_id The platform specific id's identify languages used on a platform. Their values are outline in:http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6name.html#ID. Set to null(default) if you dont care which one | ||
**Default Value: null | ***Default Value: null | ||
===getEncodedCharactersFromGlyphID()=== | ===getEncodedCharactersFromGlyphID()=== | ||
*Signature: public function getEncodedCharactersFromGlyphID($gid) | *Signature: public function getEncodedCharactersFromGlyphID($gid) | ||
Parameters: | *Parameters: | ||
*$gid | *$gid | ||
===getTTFFile()=== | ===getTTFFile()=== | ||
Line 79: | Line 71: | ||
===getUnicodeCodepointsFromGlyphID()=== | ===getUnicodeCodepointsFromGlyphID()=== | ||
*Signature: public function getUnicodeCodepointsFromGlyphID($gid) | *Signature: public function getUnicodeCodepointsFromGlyphID($gid) | ||
Parameters: | *Parameters: | ||
*$gid | *$gid | ||
===gotoTable()=== | ===gotoTable()=== | ||
*Signature: protected function gotoTable($table) | *Signature: protected function gotoTable($table) | ||
Parameters: | *Parameters: | ||
*$table | *$table | ||
===inDirectory()=== | ===inDirectory()=== | ||
*Signature: protected function inDirectory($table) | *Signature: protected function inDirectory($table) | ||
Parameters: | *Parameters: | ||
*$table | *$table | ||
===loadDirectory()=== | ===loadDirectory()=== | ||
Line 94: | Line 86: | ||
===loadin()=== | ===loadin()=== | ||
*Signature: protected function loadin($file) | *Signature: protected function loadin($file) | ||
Parameters: | *Parameters: | ||
*$file | *$file | ||
===openForReading()=== | ===openForReading()=== | ||
Line 101: | Line 93: | ||
*Signature: protected function read_FWord() | *Signature: protected function read_FWord() | ||
===read_fixed_pieces()=== | ===read_fixed_pieces()=== | ||
DATA TYPES: | DATA TYPES: http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6.html#Types Macintosh Data type OS/2 Data Type Description uint8 BYTE 8-bit unsigned integer int8 CHAR 8-bit signed integer uint16 USHORT 16-bit unsigned integer int16 SHORT 16-bit signed integer uint32 ULONG 32-bit unsigned integer int32 LONG 32-bit signed integer shortFrac - 16-bit signed fraction Fixed - 16.16-bit signed fixed-point number FWord - 16-bit signed integer that describes a quantity in FUnits, the smallest measurable distance in em space. uFWord - 16-bit unsigned integer that describes a quantity in FUnits, the smallest measurable distance in em space. F2Dot14 - 16-bit signed fixed number with the low 14 bits representing fraction. longDateTime - The long internal format of a date in seconds since 12:00 midnight, January 1, 1904. It is represented as a signed 64-bit integer. NOTE: We are Big-Endian here | ||
http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6.html#Types | |||
Macintosh Data type OS/2 Data Type Description | |||
uint8 BYTE 8-bit unsigned integer | |||
int8 CHAR 8-bit signed integer | |||
uint16 USHORT 16-bit unsigned integer | |||
int16 SHORT 16-bit signed integer | |||
uint32 ULONG 32-bit unsigned integer | |||
int32 LONG 32-bit signed integer | |||
shortFrac - 16-bit signed fraction | |||
Fixed - 16.16-bit signed fixed-point number | |||
FWord - 16-bit signed integer that describes a quantity in FUnits, the smallest measurable distance in em space. | |||
uFWord - 16-bit unsigned integer that describes a quantity in FUnits, the smallest measurable distance in em space. | |||
F2Dot14 - 16-bit signed fixed number with the low 14 bits representing fraction. | |||
longDateTime - The long internal format of a date in seconds since 12:00 midnight, January 1, 1904. It is represented as a signed 64-bit integer. | |||
NOTE: We are Big-Endian here | |||
*Signature: protected function read_fixed_pieces() | *Signature: protected function read_fixed_pieces() | ||
===read_glyf()=== | ===read_glyf()=== | ||
Line 136: | Line 112: | ||
===read_kern()=== | ===read_kern()=== | ||
*Signature: public function read_kern($old_format) | *Signature: public function read_kern($old_format) | ||
Parameters: | *Parameters: | ||
*$old_format | *$old_format | ||
**Default Value: true | ***Default Value: true | ||
===read_loca()=== | ===read_loca()=== | ||
*Signature: protected function read_loca() | *Signature: protected function read_loca() | ||
Line 155: | Line 131: | ||
===setCIDtoGID()=== | ===setCIDtoGID()=== | ||
*Signature: protected function setCIDtoGID($CIDtoGID,$cid,$gid,$warning,$try_unicode) | *Signature: protected function setCIDtoGID($CIDtoGID,$cid,$gid,$warning,$try_unicode) | ||
Parameters: | *Parameters: | ||
*&$CIDtoGID | **&$CIDtoGID | ||
*$cid | *$cid | ||
*$gid | *$gid | ||
*$warning | *$warning | ||
*$try_unicode | *$try_unicode | ||
**Default Value: false | ***Default Value: false | ||
===showCharacterInfo()=== | ===showCharacterInfo()=== | ||
*Signature: public function showCharacterInfo() | *Signature: public function showCharacterInfo() |
Revision as of 22:43, 16 October 2009
This article desrcibes the class I2CE_FontMetricTTF.
- Extends the class: I2CE_FontMetricMultiDirection.
- Location: Part of the module textlayout in the package TextLayout Tools
- Source: Defined in the file lib/I2CE_FontMetricTTF.php
- Author: Carl Leitner <litlfred@ibiblio.org>
Class to contain information about font metrics. Data extracted from TTF files
Variables
$ttf_file
- Type: protected $ttf_file
$ttf_handle
- Type: protected $ttf_handle
$directory
- Type: protected $directory
$numOfLongHorMetrics
- Type: protected $numOfLongHorMetrics
$num_glyphs
- Type: protected $num_glyphs
$GIDtoCPs
- Type: protected $GIDtoCPs
$indexToLocFormat
- Type: protected $indexToLocFormat
$glyph_offsets
- Type: protected $glyph_offsets
$units_per_em
- Type: protected $units_per_em
$file_size
- Type: protected $file_size
$fix
Some common incorrect glyph names
- Type: static protected fix $fix
Methods
__construct()
- Signature: public function __construct($encoding,$ttf_file)
- Parameters:
- &$encoding
- $ttf_file
close()
- Signature: protected function close()
generate_PDF_CMAP()
- Signature: public function generate_PDF_CMAP($platform_id,$platform_specific_id)
- Parameters:
- $platform_id
- Default Value: null
- $platform_specific_id
- Default Value: null
getCIDtoGIDmap()
$param int $platform_id is the Platform ID. Default is null which means we dont care. The platform ID follows this table
Platform ID | Platform | Specific encoding |
0 | Unicode | Indicates Unicode version. |
1 | Macintosh | Script Manager code. |
3 | Microsoft | Microsoft encoding. |
- Signature: public function getCIDtoGIDmap($platform_id,$platform_specific_id)
- Parameters:
- $platform_id
- Default Value: null
- int $platform_specific_id The platform specific id's identify languages used on a platform. Their values are outline in:http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6name.html#ID. Set to null(default) if you dont care which one
- Default Value: null
getEncodedCharactersFromGlyphID()
- Signature: public function getEncodedCharactersFromGlyphID($gid)
- Parameters:
- $gid
getTTFFile()
- Signature: public function getTTFFile()
getUnicodeCodepointsFromGlyphID()
- Signature: public function getUnicodeCodepointsFromGlyphID($gid)
- Parameters:
- $gid
gotoTable()
- Signature: protected function gotoTable($table)
- Parameters:
- $table
inDirectory()
- Signature: protected function inDirectory($table)
- Parameters:
- $table
loadDirectory()
Reference:http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6.html
- Signature: protected function loadDirectory()
loadin()
- Signature: protected function loadin($file)
- Parameters:
- $file
openForReading()
- Signature: protected function openForReading()
read_FWord()
- Signature: protected function read_FWord()
read_fixed_pieces()
DATA TYPES: http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6.html#Types Macintosh Data type OS/2 Data Type Description uint8 BYTE 8-bit unsigned integer int8 CHAR 8-bit signed integer uint16 USHORT 16-bit unsigned integer int16 SHORT 16-bit signed integer uint32 ULONG 32-bit unsigned integer int32 LONG 32-bit signed integer shortFrac - 16-bit signed fraction Fixed - 16.16-bit signed fixed-point number FWord - 16-bit signed integer that describes a quantity in FUnits, the smallest measurable distance in em space. uFWord - 16-bit unsigned integer that describes a quantity in FUnits, the smallest measurable distance in em space. F2Dot14 - 16-bit signed fixed number with the low 14 bits representing fraction. longDateTime - The long internal format of a date in seconds since 12:00 midnight, January 1, 1904. It is represented as a signed 64-bit integer. NOTE: We are Big-Endian here
- Signature: protected function read_fixed_pieces()
read_glyf()
- Signature: protected function read_glyf()
read_head()
- Signature: protected function read_head()
read_hhea()
- Signature: protected function read_hhea()
read_hmtx()
See http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6hmtx.html
- Signature: protected function read_hmtx()
read_int16()
- Signature: protected function read_int16()
read_int32()
- Signature: protected function read_int32()
read_int8()
- Signature: protected function read_int8()
read_kern()
- Signature: public function read_kern($old_format)
- Parameters:
- $old_format
- Default Value: true
read_loca()
- Signature: protected function read_loca()
read_name()
- Signature: protected function read_name()
read_numGlyphs()
- Signature: protected function read_numGlyphs()
read_uFWord()
- Signature: protected function read_uFWord()
read_uint16()
- Signature: protected function read_uint16()
read_uint32()
- Signature: protected function read_uint32()
read_uint8()
- Signature: protected function read_uint8()
setCIDtoGID()
- Signature: protected function setCIDtoGID($CIDtoGID,$cid,$gid,$warning,$try_unicode)
- Parameters:
- &$CIDtoGID
- $cid
- $gid
- $warning
- $try_unicode
- Default Value: false
showCharacterInfo()
- Signature: public function showCharacterInfo()
Inherited Variables
$font_metrics
Theis protected variable is inherited from I2CE_FontMetricMultiDirection->$font_metrics
$direction
Theis protected variable is inherited from I2CE_FontMetricMultiDirection->$direction
$directions
Theis protected variable is inherited from I2CE_FontMetricMultiDirection->$directions
$character_widths
Theis public variable is inherited from I2CE_FontMetric->$character_widths
$character_heights
Theis public variable is inherited from I2CE_FontMetric->$character_heights
$character_info
Theis public variable is inherited from I2CE_FontMetric->$character_info
$bbox
Theis protected variable is inherited from I2CE_FontMetric->$bbox
$ascender
Theis protected variable is inherited from I2CE_FontMetric->$ascender
$descender
Theis protected variable is inherited from I2CE_FontMetric->$descender
$linegap
Theis protected variable is inherited from I2CE_FontMetric->$linegap
$is_fixed_width
Theis protected variable is inherited from I2CE_FontMetric->$is_fixed_width
$fixed_character_width
Theis protected variable is inherited from I2CE_FontMetric->$fixed_character_width
$fixed_character_height
Theis protected variable is inherited from I2CE_FontMetric->$fixed_character_height
$size
Theis protected variable is inherited from I2CE_FontMetric->$size
$encoding
Theis protected variable is inherited from I2CE_FontMetric->$encoding
$kerning_table_pairs
Theis protected variable is inherited from I2CE_FontMetric->$kerning_table_pairs
$kerning_table_groups
Theis protected variable is inherited from I2CE_FontMetric->$kerning_table_groups
$kerning_groups
Theis protected variable is inherited from I2CE_FontMetric->$kerning_groups
$font_info
Theis protected variable is inherited from I2CE_FontMetric->$font_info