Class: I2CE FontMetric: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 5: Line 5:
*** [[Class: I2CE_FontMetricTTF | I2CE_FontMetricTTF]]
*** [[Class: I2CE_FontMetricTTF | I2CE_FontMetricTTF]]
*Location: Part of the module [[TextLayout Tools Module List#textlayout|textlayout]] in the package [https://launchpad.net/textlayout TextLayout Tools]
*Location: Part of the module [[TextLayout Tools Module List#textlayout|textlayout]] in the package [https://launchpad.net/textlayout TextLayout Tools]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.1-release/annotate/head:/lib/I2CE_FontMetric.php lib/I2CE_FontMetric.php]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L22 lib/I2CE_FontMetric.php] on line 22
*Author: Carl Leitner <litlfred@ibiblio.org>
*Author: Carl Leitner <litlfred@ibiblio.org>
Class to contain information about  font metrics.
Class to contain information about  font metrics.
Line 11: Line 11:
===$bbox===
===$bbox===
protected @var $bbox of numeric. the bounding box with values in order llx lly urx ury
protected @var $bbox of numeric. the bounding box with values in order llx lly urx ury
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L26 textlayout/lib/I2CE_FontMetric.php] on line 26
*Type: protected $bbox
*Type: protected $bbox


===$ascender===
===$ascender===
protected @var numeric $ascender
protected @var numeric $ascender
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L30 textlayout/lib/I2CE_FontMetric.php] on line 30
*Type: protected $ascender
*Type: protected $ascender


===$descender===
===$descender===
protected @var numeric $ascender
protected @var numeric $ascender
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L35 textlayout/lib/I2CE_FontMetric.php] on line 35
*Type: protected $descender
*Type: protected $descender


===$linegap===
===$linegap===
protected @var numeric $linegap
protected @var numeric $linegap
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L40 textlayout/lib/I2CE_FontMetric.php] on line 40
*Type: protected $linegap
*Type: protected $linegap


===$is_fixed_width===
===$is_fixed_width===
protected @var array of boolean $is_fixed_width whether or not this font is fixed width
protected @var array of boolean $is_fixed_width whether or not this font is fixed width
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L45 textlayout/lib/I2CE_FontMetric.php] on line 45
*Type: protected $is_fixed_width
*Type: protected $is_fixed_width


===$fixed_character_width===
===$fixed_character_width===
protected @var  int  the size of a fixed width character
protected @var  int  the size of a fixed width character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L50 textlayout/lib/I2CE_FontMetric.php] on line 50
*Type: protected $fixed_character_width
*Type: protected $fixed_character_width


===$fixed_character_height===
===$fixed_character_height===
protected @var  int  the size of a fixed width character
protected @var  int  the size of a fixed width character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L56 textlayout/lib/I2CE_FontMetric.php] on line 56
*Type: protected $fixed_character_height
*Type: protected $fixed_character_height


===$size===
===$size===
protected @var int $size  the font size in points
protected @var int $size  the font size in points
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L62 textlayout/lib/I2CE_FontMetric.php] on line 62
*Type: protected $size
*Type: protected $size


===$encoding===
===$encoding===
proteted @var I2CE_Encoding encoding  data  for the character set
proteted @var I2CE_Encoding encoding  data  for the character set
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L69 textlayout/lib/I2CE_FontMetric.php] on line 69
*Type: protected $encoding
*Type: protected $encoding


===$kerning_table_pairs===
===$kerning_table_pairs===
protected @var array of array of numbers $kerning_table_pairs  the kerning table for pairs. the first index is the preceeding character the second index is the following character
protected @var array of array of numbers $kerning_table_pairs  the kerning table for pairs. the first index is the preceeding character the second index is the following character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L76 textlayout/lib/I2CE_FontMetric.php] on line 76
*Type: protected $kerning_table_pairs
*Type: protected $kerning_table_pairs


===$kerning_table_groups===
===$kerning_table_groups===
protected @var array of array of numbers $kerning_table_groups  the kerning table for groups. the first index is the group for the preceeding character the second index is the group for the following character
protected @var array of array of numbers $kerning_table_groups  the kerning table for groups. the first index is the group for the preceeding character the second index is the group for the following character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L82 textlayout/lib/I2CE_FontMetric.php] on line 82
*Type: protected $kerning_table_groups
*Type: protected $kerning_table_groups


===$kerning_groups===
===$kerning_groups===
protected $var array with keys character and values the kerning groups
protected $var array with keys character and values the kerning groups
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L87 textlayout/lib/I2CE_FontMetric.php] on line 87
*Type: protected $kerning_groups
*Type: protected $kerning_groups


===$character_widths===
===$character_widths===
of floats containing $character_widths the character widths for the current font to be super  redundant the keys will be either the character code or the glyph name
of floats containing $character_widths the character widths for the current font to be super  redundant the keys will be either the character code or the glyph name
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L95 textlayout/lib/I2CE_FontMetric.php] on line 95
*Type: public [http://www.php.net/manual/en/language.types.array.php array ] $character_widths
*Type: public [http://www.php.net/manual/en/language.types.array.php array ] $character_widths


===$character_heights===
===$character_heights===
of array of floats  $character_heights containing the character heights for the current font to be super  redundant the keys will be either the character code or the glyph name
of array of floats  $character_heights containing the character heights for the current font to be super  redundant the keys will be either the character code or the glyph name
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L102 textlayout/lib/I2CE_FontMetric.php] on line 102
*Type: public [http://www.php.net/manual/en/language.types.array.php array ] $character_heights
*Type: public [http://www.php.net/manual/en/language.types.array.php array ] $character_heights


===$character_info===
===$character_info===
of array of mixed $character_info containing character information (besides the width)
of array of mixed $character_info containing character information (besides the width)
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L107 textlayout/lib/I2CE_FontMetric.php] on line 107
*Type: public [http://www.php.net/manual/en/language.types.array.php array ] $character_info
*Type: public [http://www.php.net/manual/en/language.types.array.php array ] $character_info


===$font_info===
===$font_info===
protected @var array of mixed global font information
protected @var array of mixed global font information
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L112 textlayout/lib/I2CE_FontMetric.php] on line 112
*Type: protected $font_info
*Type: protected $font_info


==Methods==
==Methods==
===__construct()===
===__construct()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L119 textlayout/lib/I2CE_FontMetric.php] on line 119
*Signature: public function __construct($encoding)
*Signature: public function __construct($encoding)
*Parameters:
*Parameters:
Line 80: Line 97:
===getAllFontCharacteristics()===
===getAllFontCharacteristics()===
Get all the font information
Get all the font information
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L451 textlayout/lib/I2CE_FontMetric.php] on line 451
*Signature: public function getAllFontCharacteristics()
*Signature: public function getAllFontCharacteristics()
===getAscender()===
===getAscender()===
get the asceneder value
get the asceneder value
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L231 textlayout/lib/I2CE_FontMetric.php] on line 231
*Signature: public function getAscender()
*Signature: public function getAscender()
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php numeric ]<br/>$ascender *
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php numeric ]<br/>$ascender *
===getBoundingBox()===
===getBoundingBox()===
Get the bounding box $returns array $bbox of numeric. The bounding box in llx lly urx ury order
Get the bounding box $returns array $bbox of numeric. The bounding box in llx lly urx ury order
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L283 textlayout/lib/I2CE_FontMetric.php] on line 283
*Signature: public function getBoundingBox()
*Signature: public function getBoundingBox()
===getCharacterHeight()===
===getCharacterHeight()===
Gets the character height of a character
Gets the character height of a character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L413 textlayout/lib/I2CE_FontMetric.php] on line 413
*Signature: public function getCharacterHeight($ch,$use_font_size)
*Signature: public function getCharacterHeight($ch,$use_font_size)
*Parameters:
*Parameters:
Line 98: Line 119:
===getCharacterHeights()===
===getCharacterHeights()===
Get the character heights
Get the character heights
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L443 textlayout/lib/I2CE_FontMetric.php] on line 443
*Signature: public function getCharacterHeights()
*Signature: public function getCharacterHeights()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of number, the values of which are the heights and the keys of which are some combination of glpyh names, character codes, and unicodes codepoints, or characters
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of number, the values of which are the heights and the keys of which are some combination of glpyh names, character codes, and unicodes codepoints, or characters
===getCharacterInfo()===
===getCharacterInfo()===
Get information associated to  a character
Get information associated to  a character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L335 textlayout/lib/I2CE_FontMetric.php] on line 335
*Signature: public function getCharacterInfo($ch,$key)
*Signature: public function getCharacterInfo($ch,$key)
*Parameters:
*Parameters:
Line 109: Line 132:
===getCharacterWidth()===
===getCharacterWidth()===
Gets the character width of a character
Gets the character width of a character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L363 textlayout/lib/I2CE_FontMetric.php] on line 363
*Signature: public function getCharacterWidth($ch,$use_font_size)
*Signature: public function getCharacterWidth($ch,$use_font_size)
*Parameters:
*Parameters:
Line 117: Line 141:
===getCharacterWidths()===
===getCharacterWidths()===
Get the character widths
Get the character widths
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L432 textlayout/lib/I2CE_FontMetric.php] on line 432
*Signature: public function getCharacterWidths()
*Signature: public function getCharacterWidths()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of number, the values of which are the widths and the keys of which are some combination of glpyh names, character codes, and unicodes codepoints, or characters
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of number, the values of which are the widths and the keys of which are some combination of glpyh names, character codes, and unicodes codepoints, or characters
===getDescender()===
===getDescender()===
get the desceneder value
get the desceneder value
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L248 textlayout/lib/I2CE_FontMetric.php] on line 248
*Signature: public function getDescender()
*Signature: public function getDescender()
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php numeric ]<br/>$descender *
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php numeric ]<br/>$descender *
===getEncoding()===
===getEncoding()===
Get the encoding used for the internal storage of strings/characters
Get the encoding used for the internal storage of strings/characters
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L128 textlayout/lib/I2CE_FontMetric.php] on line 128
*Signature: public function getEncoding()
*Signature: public function getEncoding()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getFixedStringWidth()===
===getFixedStringWidth()===
Caluclulate the length of a fixed width string
Caluclulate the length of a fixed width string
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L136 textlayout/lib/I2CE_FontMetric.php] on line 136
*Signature: protected function getFixedStringWidth($string)
*Signature: protected function getFixedStringWidth($string)
*Parameters:
*Parameters:
Line 135: Line 163:
===getFixedWidth()===
===getFixedWidth()===
Get the width of a character in a fixed width font
Get the width of a character in a fixed width font
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L319 textlayout/lib/I2CE_FontMetric.php] on line 319
*Signature: public function getFixedWidth()
*Signature: public function getFixedWidth()
*Returns: number<br/>Returns null if called when the current font is not fixed width
*Returns: number<br/>Returns null if called when the current font is not fixed width
===getFontCharacteristic()===
===getFontCharacteristic()===
Get a global font characteristic @param $key
Get a global font characteristic @param $key
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L474 textlayout/lib/I2CE_FontMetric.php] on line 474
*Signature: public function getFontCharacteristic($key)
*Signature: public function getFontCharacteristic($key)
*Parameters:
*Parameters:
Line 145: Line 175:
===getFontSize()===
===getFontSize()===
Get the font size
Get the font size
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L493 textlayout/lib/I2CE_FontMetric.php] on line 493
*Signature: public function getFontSize()
*Signature: public function getFontSize()
*Returns: [http://www.php.net/manual/en/language.types.integer.php int ]
*Returns: [http://www.php.net/manual/en/language.types.integer.php int ]
===getKerningByGroup()===
===getKerningByGroup()===
get the kerning values associated to a pair of groups
get the kerning values associated to a pair of groups
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L570 textlayout/lib/I2CE_FontMetric.php] on line 570
*Signature: public function getKerningByGroup($g1,$g2,$use_font_size)
*Signature: public function getKerningByGroup($g1,$g2,$use_font_size)
*Parameters:
*Parameters:
Line 158: Line 190:
===getKerningByPair()===
===getKerningByPair()===
get the kerning values associated to a pair of character
get the kerning values associated to a pair of character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L530 textlayout/lib/I2CE_FontMetric.php] on line 530
*Signature: public function getKerningByPair($ch1,$ch2,$use_font_size)
*Signature: public function getKerningByPair($ch1,$ch2,$use_font_size)
*Parameters:
*Parameters:
Line 167: Line 200:
===getKerningGroup()===
===getKerningGroup()===
Get the kerning groups associated to a character
Get the kerning groups associated to a character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L503 textlayout/lib/I2CE_FontMetric.php] on line 503
*Signature: public function getKerningGroup($ch)
*Signature: public function getKerningGroup($ch)
*Parameters:
*Parameters:
Line 173: Line 207:
===getKerningValue()===
===getKerningValue()===
Return the (horizontal) kerning values for a pair of characters If there is kerning info for both groups and pairs, the pairs takes prescedence @params string $ch1 the left characcter @params string $ch2 the right character @param bool use_font_size default false --
Return the (horizontal) kerning values for a pair of characters If there is kerning info for both groups and pairs, the pairs takes prescedence @params string $ch1 the left characcter @params string $ch2 the right character @param bool use_font_size default false --
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L613 textlayout/lib/I2CE_FontMetric.php] on line 613
*Signature: public function getKerningValue($ch1,$ch2,$use_font_size)
*Signature: public function getKerningValue($ch1,$ch2,$use_font_size)
*Parameters:
*Parameters:
Line 181: Line 216:
===getLinegap()===
===getLinegap()===
get the line gap value
get the line gap value
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L265 textlayout/lib/I2CE_FontMetric.php] on line 265
*Signature: public function getLinegap()
*Signature: public function getLinegap()
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php numeric ]<br/>$linegap *
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php numeric ]<br/>$linegap *
===getStringWidth()===
===getStringWidth()===
Caluclulate the length of a string
Caluclulate the length of a string
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L154 textlayout/lib/I2CE_FontMetric.php] on line 154
*Signature: public function getStringWidth($string,$use_font_size)
*Signature: public function getStringWidth($string,$use_font_size)
*Parameters:
*Parameters:
Line 193: Line 230:
===getTrackingValues()===
===getTrackingValues()===
Get the tracking values for the current font size
Get the tracking values for the current font size
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L632 textlayout/lib/I2CE_FontMetric.php] on line 632
*Signature: public function getTrackingValues()
*Signature: public function getTrackingValues()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>$values of floats.  $values[0] is the minimum, $values[1] is the maximum or null if if there is no tracking values
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>$values of floats.  $values[0] is the minimum, $values[1] is the maximum or null if if there is no tracking values
===getVariableStringWidth()===
===getVariableStringWidth()===
Function caluclulate the length of a variable width string
Function caluclulate the length of a variable width string
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L178 textlayout/lib/I2CE_FontMetric.php] on line 178
*Signature: protected function getVariableStringWidth($string)
*Signature: protected function getVariableStringWidth($string)
*Parameters:
*Parameters:
Line 203: Line 242:
===isFixedWidth()===
===isFixedWidth()===
Check to see if the current font is fixed width
Check to see if the current font is fixed width
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L308 textlayout/lib/I2CE_FontMetric.php] on line 308
*Signature: public function isFixedWidth()
*Signature: public function isFixedWidth()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]<br/>true if it is fixed width
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]<br/>true if it is fixed width
===setAscender()===
===setAscender()===
set the asceneder value
set the asceneder value
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L222 textlayout/lib/I2CE_FontMetric.php] on line 222
*Signature: public function setAscender($ascender)
*Signature: public function setAscender($ascender)
*Parameters:
*Parameters:
Line 212: Line 253:
===setBoundingBox()===
===setBoundingBox()===
Set the bounding box $param array $bbox of numeric. The bounding box in llx lly urx ury order
Set the bounding box $param array $bbox of numeric. The bounding box in llx lly urx ury order
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L275 textlayout/lib/I2CE_FontMetric.php] on line 275
*Signature: public function setBoundingBox($bbox)
*Signature: public function setBoundingBox($bbox)
*Parameters:
*Parameters:
Line 217: Line 259:
===setCharacterHeight()===
===setCharacterHeight()===
Sets the character width of a character
Sets the character width of a character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L400 textlayout/lib/I2CE_FontMetric.php] on line 400
*Signature: public function setCharacterHeight($ch,$h)
*Signature: public function setCharacterHeight($ch,$h)
*Parameters:
*Parameters:
Line 223: Line 266:
===setCharacterInfo()===
===setCharacterInfo()===
Sets information associated to  a character
Sets information associated to  a character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L349 textlayout/lib/I2CE_FontMetric.php] on line 349
*Signature: public function setCharacterInfo($ch,$key,$value)
*Signature: public function setCharacterInfo($ch,$key,$value)
*Parameters:
*Parameters:
Line 230: Line 274:
===setCharacterWidth()===
===setCharacterWidth()===
Sets the character width of a character
Sets the character width of a character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L384 textlayout/lib/I2CE_FontMetric.php] on line 384
*Signature: public function setCharacterWidth($ch,$w)
*Signature: public function setCharacterWidth($ch,$w)
*Parameters:
*Parameters:
Line 236: Line 281:
===setDescender()===
===setDescender()===
set the desceneder value
set the desceneder value
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L239 textlayout/lib/I2CE_FontMetric.php] on line 239
*Signature: public function setDescender($descender)
*Signature: public function setDescender($descender)
*Parameters:
*Parameters:
Line 241: Line 287:
===setFixedHeightSize()===
===setFixedHeightSize()===
set the fixed height character size
set the fixed height character size
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L300 textlayout/lib/I2CE_FontMetric.php] on line 300
*Signature: public function setFixedHeightSize($height)
*Signature: public function setFixedHeightSize($height)
*Parameters:
*Parameters:
Line 246: Line 293:
===setFixedWidth()===
===setFixedWidth()===
Set whether or not this is a fixed width font @parma boolean $is_fixed_width
Set whether or not this is a fixed width font @parma boolean $is_fixed_width
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L213 textlayout/lib/I2CE_FontMetric.php] on line 213
*Signature: public function setFixedWidth($is_fixed_width)
*Signature: public function setFixedWidth($is_fixed_width)
*Parameters:
*Parameters:
Line 251: Line 299:
===setFixedWidthSize()===
===setFixedWidthSize()===
set the fixed width character size
set the fixed width character size
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L292 textlayout/lib/I2CE_FontMetric.php] on line 292
*Signature: public function setFixedWidthSize($width)
*Signature: public function setFixedWidthSize($width)
*Parameters:
*Parameters:
Line 256: Line 305:
===setFontCharacteristic()===
===setFontCharacteristic()===
Set a global font characteristic
Set a global font characteristic
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L462 textlayout/lib/I2CE_FontMetric.php] on line 462
*Signature: public function setFontCharacteristic($key,$value)
*Signature: public function setFontCharacteristic($key,$value)
*Parameters:
*Parameters:
Line 262: Line 312:
===setFontSize()===
===setFontSize()===
Set the font size @params int $size
Set the font size @params int $size
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L485 textlayout/lib/I2CE_FontMetric.php] on line 485
*Signature: public function setFontSize($size)
*Signature: public function setFontSize($size)
*Parameters:
*Parameters:
Line 267: Line 318:
===setKerningByGroup()===
===setKerningByGroup()===
get the kerning values associated to a pair of groups
get the kerning values associated to a pair of groups
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L592 textlayout/lib/I2CE_FontMetric.php] on line 592
*Signature: public function setKerningByGroup($g1,$g2,$kern)
*Signature: public function setKerningByGroup($g1,$g2,$kern)
*Parameters:
*Parameters:
Line 274: Line 326:
===setKerningByPair()===
===setKerningByPair()===
set the kerning values associated to a pair of character
set the kerning values associated to a pair of character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L551 textlayout/lib/I2CE_FontMetric.php] on line 551
*Signature: public function setKerningByPair($ch1,$ch2,$kern)
*Signature: public function setKerningByPair($ch1,$ch2,$kern)
*Parameters:
*Parameters:
Line 281: Line 334:
===setKerningGroup()===
===setKerningGroup()===
Set the kerning groups associated to a character
Set the kerning groups associated to a character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L516 textlayout/lib/I2CE_FontMetric.php] on line 516
*Signature: public function setKerningGroup($ch,$group)
*Signature: public function setKerningGroup($ch,$group)
*Parameters:
*Parameters:
Line 287: Line 341:
===setLinegap()===
===setLinegap()===
set the line gap value
set the line gap value
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_FontMetric.php#L256 textlayout/lib/I2CE_FontMetric.php] on line 256
*Signature: public function setLinegap($linegap)
*Signature: public function setLinegap($linegap)
*Parameters:
*Parameters:

Revision as of 09:49, 10 November 2009

This article describes the class I2CE_FontMetric.

Class to contain information about font metrics.

Variables

$bbox

protected @var $bbox of numeric. the bounding box with values in order llx lly urx ury

$ascender

protected @var numeric $ascender

$descender

protected @var numeric $ascender

$linegap

protected @var numeric $linegap

$is_fixed_width

protected @var array of boolean $is_fixed_width whether or not this font is fixed width

$fixed_character_width

protected @var int the size of a fixed width character

$fixed_character_height

protected @var int the size of a fixed width character

$size

protected @var int $size the font size in points

$encoding

proteted @var I2CE_Encoding encoding data for the character set

$kerning_table_pairs

protected @var array of array of numbers $kerning_table_pairs the kerning table for pairs. the first index is the preceeding character the second index is the following character

$kerning_table_groups

protected @var array of array of numbers $kerning_table_groups the kerning table for groups. the first index is the group for the preceeding character the second index is the group for the following character

$kerning_groups

protected $var array with keys character and values the kerning groups

$character_widths

of floats containing $character_widths the character widths for the current font to be super redundant the keys will be either the character code or the glyph name

$character_heights

of array of floats $character_heights containing the character heights for the current font to be super redundant the keys will be either the character code or the glyph name

$character_info

of array of mixed $character_info containing character information (besides the width)

$font_info

protected @var array of mixed global font information

Methods

__construct()

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 119
  • Signature: public function __construct($encoding)
  • Parameters:
    • I2CE_Encoding $encoding
      the encoding used for the internal storage of strings/characters needs to be one that is a valid encoding for PHP multibyte strings.

getAllFontCharacteristics()

Get all the font information

getAscender()

get the asceneder value

getBoundingBox()

Get the bounding box $returns array $bbox of numeric. The bounding box in llx lly urx ury order

getCharacterHeight()

Gets the character height of a character

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 413
  • Signature: public function getCharacterHeight($ch,$use_font_size)
  • Parameters:
    • mixed $ch
      a character @param bool use_font_size default false --
    • $use_font_size
      • Default Value: false
  • Returns: float
    the width

getCharacterHeights()

Get the character heights

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 443
  • Signature: public function getCharacterHeights()
  • Returns: array
    of number, the values of which are the heights and the keys of which are some combination of glpyh names, character codes, and unicodes codepoints, or characters

getCharacterInfo()

Get information associated to a character

getCharacterWidth()

Gets the character width of a character

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 363
  • Signature: public function getCharacterWidth($ch,$use_font_size)
  • Parameters:
    • mixed $ch
      a character (or glyphname) @param bool use_font_size default false --
    • $use_font_size
      • Default Value: false
  • Returns: float
    the width

getCharacterWidths()

Get the character widths

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 432
  • Signature: public function getCharacterWidths()
  • Returns: array
    of number, the values of which are the widths and the keys of which are some combination of glpyh names, character codes, and unicodes codepoints, or characters

getDescender()

get the desceneder value

getEncoding()

Get the encoding used for the internal storage of strings/characters

getFixedStringWidth()

Caluclulate the length of a fixed width string

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 136
  • Signature: protected function getFixedStringWidth($string)
  • Parameters:
    • string $string
      the string we wish to calculate the length of
  • Returns: float/int
    the length of the string

getFixedWidth()

Get the width of a character in a fixed width font

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 319
  • Signature: public function getFixedWidth()
  • Returns: number
    Returns null if called when the current font is not fixed width

getFontCharacteristic()

Get a global font characteristic @param $key

getFontSize()

Get the font size

getKerningByGroup()

get the kerning values associated to a pair of groups

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 570
  • Signature: public function getKerningByGroup($g1,$g2,$use_font_size)
  • Parameters:
    • mixed $g1
      the preceeding group
    • mixed $g2
      the following group @param bool use_font_size default false --
    • $use_font_size
      • Default Value: false
  • Returns: numeric
    $kern the kerning value or null if none found

getKerningByPair()

get the kerning values associated to a pair of character

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 530
  • Signature: public function getKerningByPair($ch1,$ch2,$use_font_size)
  • Parameters:
    • mixed $ch1
      the preceeding character
    • mixed $ch2
      the following character @param bool use_font_size default false --
    • $use_font_size
      • Default Value: false
  • Returns: numeric
    the kerning value or null if there is none found

getKerningGroup()

Get the kerning groups associated to a character

getKerningValue()

Return the (horizontal) kerning values for a pair of characters If there is kerning info for both groups and pairs, the pairs takes prescedence @params string $ch1 the left characcter @params string $ch2 the right character @param bool use_font_size default false --

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 613
  • Signature: public function getKerningValue($ch1,$ch2,$use_font_size)
  • Parameters:
    • $ch1
    • $ch2
    • $use_font_size
  • Returns: number
    the kerning value or null if none is found

getLinegap()

get the line gap value

getStringWidth()

Caluclulate the length of a string

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 154
  • Signature: public function getStringWidth($string,$use_font_size)
  • Parameters:
    • string $string
      the string we wish to calculate the length of
    • $use_font_size
      • Default Value: false
  • Returns: float/int
    the length of the string note: if it is a fixed width font, we assume that all characters are printable. in particular a line break is considered a printable character. If you have line breaks to deal with @param bool use_font_size default false -- you should see TextColumn

getTrackingValues()

Get the tracking values for the current font size

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 632
  • Signature: public function getTrackingValues()
  • Returns: array
    $values of floats. $values[0] is the minimum, $values[1] is the maximum or null if if there is no tracking values

getVariableStringWidth()

Function caluclulate the length of a variable width string

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 178
  • Signature: protected function getVariableStringWidth($string)
  • Parameters:
    • string $string
      the string we wish to calculate the length of @param bool use_font_size default false --
  • Returns: float
    the length of the string

isFixedWidth()

Check to see if the current font is fixed width

setAscender()

set the asceneder value

setBoundingBox()

Set the bounding box $param array $bbox of numeric. The bounding box in llx lly urx ury order

setCharacterHeight()

Sets the character width of a character

setCharacterInfo()

Sets information associated to a character

setCharacterWidth()

Sets the character width of a character

setDescender()

set the desceneder value

setFixedHeightSize()

set the fixed height character size

setFixedWidth()

Set whether or not this is a fixed width font @parma boolean $is_fixed_width

setFixedWidthSize()

set the fixed width character size

setFontCharacteristic()

Set a global font characteristic

setFontSize()

Set the font size @params int $size

setKerningByGroup()

get the kerning values associated to a pair of groups

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 592
  • Signature: public function setKerningByGroup($g1,$g2,$kern)
  • Parameters:
    • mixed $g1
      the preceeding group
    • mixed $g2
      the following grou @params numeric $kern the kerning value
    • $kern

setKerningByPair()

set the kerning values associated to a pair of character

  • Defined in textlayout/lib/I2CE_FontMetric.php on line 551
  • Signature: public function setKerningByPair($ch1,$ch2,$kern)
  • Parameters:
    • mixed $ch1
      the preceeding character
    • mixed $ch2
      the following character @params numeric $kern the kerning value
    • $kern

setKerningGroup()

Set the kerning groups associated to a character

setLinegap()

set the line gap value