Class: I2CE FontMetric (Development)

From IHRIS Wiki


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 415
  • 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 445
  • 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 365
  • 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 434
  • 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 321
  • 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 572
  • 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 532
  • 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 615
  • Signature: public function getKerningValue($ch1,$ch2,$use_font_size)
  • Parameters:
    • $ch1
    • $ch2
    • $use_font_size
      • Default Value: false
  • 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 634
  • 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 594
  • 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 553
  • 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