Class: I2CE Encoding: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 27: Line 27:
get the multibyte character associated to a character code
get the multibyte character associated to a character code
*Signature: public function UnicodeFromCharactercode($cc)
*Signature: public function UnicodeFromCharactercode($cc)
*Returns: [http://www.php.net/manual/en/language.types.integer.php int ] unicode codepoint
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.types.integer.php int ] $cc <br/>the character code
* [http://www.php.net/manual/en/language.types.integer.php int ] $cc<br/>the character code
*Returns: [http://www.php.net/manual/en/language.types.integer.php int ]<br/>unicode codepoint
===UnicodeFromGlyphname()===
===UnicodeFromGlyphname()===
get the multibyte character associated to a glyphname
get the multibyte character associated to a glyphname
*Signature: public function UnicodeFromGlyphname($gn)
*Signature: public function UnicodeFromGlyphname($gn)
*Returns: [http://www.php.net/manual/en/language.types.string.php string ] n character in the selected encoding
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $gn <br/>the glyp hname
* [http://www.php.net/manual/en/language.types.string.php string ] $gn<br/>the glyp hname
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>n character in the selected encoding
===UnicodeToCharacterCode()===
===UnicodeToCharacterCode()===
get the character code to a unicode codepoint
get the character code to a unicode codepoint
*Signature: public function UnicodeToCharacterCode($in)
*Signature: public function UnicodeToCharacterCode($in)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $in
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $in
===UnicodeToGlyphname()===
===UnicodeToGlyphname()===
get the glpyh name associated to to a unicode codepoint
get the glpyh name associated to to a unicode codepoint
*Signature: public function UnicodeToGlyphname($in)
*Signature: public function UnicodeToGlyphname($in)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $in
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $in
===__construct()===
===__construct()===
@param string $encoding_type -- set to the encoding used
@param string $encoding_type -- set to the encoding used needs to be  one of PHP multibyte strings encodings
needs to be  one of PHP multibyte strings encodings
*Signature: public function __construct($mb_encoding)
*Signature: public function __construct($mb_encoding)
Parameters:
*Parameters:
*$mb_encoding  
*$mb_encoding  
===changeGlyphNames()===
===changeGlyphNames()===
Change the glyph names
Change the glyph names @param $names an associative array with the new value being the value and the old value being the key
@param $names an associative array with the new value being the value
and the old value being the key
*Signature: public function changeGlyphNames($names)
*Signature: public function changeGlyphNames($names)
Parameters:
*Parameters:
*$names  
*$names  
===fixEuro()===
===fixEuro()===
Make sure U+20AC has the glyphname euro
Make sure U+20AC has the glyphname euro if it exists in this encoding
if it exists in this encoding
*Signature: public function fixEuro()
*Signature: public function fixEuro()
===getEncodingType()===
===getEncodingType()===
Get the unicode encoding to use
Get the unicode encoding to use
*Signature: public function getEncodingType()
*Signature: public function getEncodingType()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ] $encoding with values:
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>$encoding with values:
===readMap()===
===readMap()===
Read in a character encoding from a file
Read in a character encoding from a file
exmaples are cp1250.map ISO-8859-1.map etc.
this function has been graciously stolen from makefont.php
*Signature: public function readMap($enc_file)
*Signature: public function readMap($enc_file)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $enc_file<br/>the file containing the character encoded
** [http://www.php.net/manual/en/language.types.string.php string ] $enc_file <br/>the file containing the character encoded exmaples are cp1250.map ISO-8859-1.map etc. this function has been graciously stolen from makefont.php
===setCharacterCode()===
===setCharacterCode()===
Set the character code assoicated to a unicode code point
Set the character code assoicated to a unicode code point
*Signature: public function setCharacterCode($cp,$cc)
*Signature: public function setCharacterCode($cp,$cc)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.types.integer.php int ] $cp<br/>the unicode code point
** [http://www.php.net/manual/en/language.types.integer.php int ] $cp <br/>the unicode code point
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $cc<br/>the character code (either int or a character)
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $cc <br/>the character code (either int or a character)
===setEncodingType()===
===setEncodingType()===
*Signature: protected function setEncodingType($mb_encoding)
*Signature: protected function setEncodingType($mb_encoding)
Parameters:
*Parameters:
*$mb_encoding  
*$mb_encoding  
===setGlyphname()===
===setGlyphname()===
Set the gylph name of a character
Set the gylph name of a character
*Signature: public function setGlyphname($cp,$gn)
*Signature: public function setGlyphname($cp,$gn)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.types.integer.php int ] $cp<br/>the unicode code point
** [http://www.php.net/manual/en/language.types.integer.php int ] $cp <br/>the unicode code point
* [http://www.php.net/manual/en/language.types.string.php string ] $gn<br/>the glyphname
** [http://www.php.net/manual/en/language.types.string.php string ] $gn <br/>the glyphname
===useMB()===
===useMB()===
*Signature: public function useMB()
*Signature: public function useMB()

Revision as of 23:43, 16 October 2009

This article desrcibes the class I2CE_Encoding.

helper library to store/look-up glyphnames associated to a character code.

Variables

$glyph_names

protected @var $glyph_names an array of arrays with values glyph names and keys unicode codepoints the first index of the array is the encoding type

  • Type: protected $glyph_names

$encoding

  • Type: protected $encoding

$mb_encoding

protected @var string $unicode_encoding

  • Type: protected $mb_encoding

$useMB

  • Type: protected $useMB

$fix

Some common incorrect glyph names

  • Type: static public fix $fix

Methods

UnicodeFromCharactercode()

get the multibyte character associated to a character code

  • Signature: public function UnicodeFromCharactercode($cc)
  • Parameters:
    • int $cc
      the character code
  • Returns: int
    unicode codepoint

UnicodeFromGlyphname()

get the multibyte character associated to a glyphname

  • Signature: public function UnicodeFromGlyphname($gn)
  • Parameters:
  • Returns: string
    n character in the selected encoding

UnicodeToCharacterCode()

get the character code to a unicode codepoint

  • Signature: public function UnicodeToCharacterCode($in)
  • Parameters:

UnicodeToGlyphname()

get the glpyh name associated to to a unicode codepoint

  • Signature: public function UnicodeToGlyphname($in)
  • Parameters:

__construct()

@param string $encoding_type -- set to the encoding used needs to be one of PHP multibyte strings encodings

  • Signature: public function __construct($mb_encoding)
  • Parameters:
  • $mb_encoding

changeGlyphNames()

Change the glyph names @param $names an associative array with the new value being the value and the old value being the key

  • Signature: public function changeGlyphNames($names)
  • Parameters:
  • $names

fixEuro()

Make sure U+20AC has the glyphname euro if it exists in this encoding

  • Signature: public function fixEuro()

getEncodingType()

Get the unicode encoding to use

  • Signature: public function getEncodingType()
  • Returns: string
    $encoding with values:

readMap()

Read in a character encoding from a file

  • Signature: public function readMap($enc_file)
  • Parameters:
    • string $enc_file
      the file containing the character encoded exmaples are cp1250.map ISO-8859-1.map etc. this function has been graciously stolen from makefont.php

setCharacterCode()

Set the character code assoicated to a unicode code point

  • Signature: public function setCharacterCode($cp,$cc)
  • Parameters:
    • int $cp
      the unicode code point
    • mixed $cc
      the character code (either int or a character)

setEncodingType()

  • Signature: protected function setEncodingType($mb_encoding)
  • Parameters:
  • $mb_encoding

setGlyphname()

Set the gylph name of a character

  • Signature: public function setGlyphname($cp,$gn)
  • Parameters:
    • int $cp
      the unicode code point
    • string $gn
      the glyphname

useMB()

  • Signature: public function useMB()