Class: I2CE Encoding: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 1: Line 1:
This article describes the class ''I2CE_Encoding''.
This article describes the class ''I2CE_Encoding''.
*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_Encoding.php lib/I2CE_Encoding.php]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L10 lib/I2CE_Encoding.php] on line 10
helper library to store/look-up glyphnames  associated to a character code.
helper library to store/look-up glyphnames  associated to a character code.
==Variables==
==Variables==
===$glyph_names===
===$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
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
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L17 textlayout/lib/I2CE_Encoding.php] on line 17
*Type: protected $glyph_names
*Type: protected $glyph_names


===$encoding===
===$encoding===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L23 textlayout/lib/I2CE_Encoding.php] on line 23
*Type: protected $encoding
*Type: protected $encoding


===$mb_encoding===
===$mb_encoding===
protected @var string $unicode_encoding
protected @var string $unicode_encoding
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L28 textlayout/lib/I2CE_Encoding.php] on line 28
*Type: protected $mb_encoding
*Type: protected $mb_encoding


===$useMB===
===$useMB===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L59 textlayout/lib/I2CE_Encoding.php] on line 59
*Type: protected $useMB
*Type: protected $useMB


===$fix===
===$fix===
Some common incorrect glyph names
Some common incorrect glyph names
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L194 textlayout/lib/I2CE_Encoding.php] on line 194
*Type: static public fix $fix
*Type: static public fix $fix


Line 25: Line 30:
===UnicodeFromCharactercode()===
===UnicodeFromCharactercode()===
get the multibyte character associated to a character code
get the multibyte character associated to a character code
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L100 textlayout/lib/I2CE_Encoding.php] on line 100
*Signature: public function UnicodeFromCharactercode($cc)
*Signature: public function UnicodeFromCharactercode($cc)
*Parameters:
*Parameters:
Line 31: Line 37:
===UnicodeFromGlyphname()===
===UnicodeFromGlyphname()===
get the multibyte character associated to a glyphname
get the multibyte character associated to a glyphname
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L86 textlayout/lib/I2CE_Encoding.php] on line 86
*Signature: public function UnicodeFromGlyphname($gn)
*Signature: public function UnicodeFromGlyphname($gn)
*Parameters:
*Parameters:
Line 37: Line 44:
===UnicodeToCharacterCode()===
===UnicodeToCharacterCode()===
get the character code to a unicode codepoint
get the character code to a unicode codepoint
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L108 textlayout/lib/I2CE_Encoding.php] on line 108
*Signature: public function UnicodeToCharacterCode($in)
*Signature: public function UnicodeToCharacterCode($in)
*Parameters:
*Parameters:
Line 42: Line 50:
===UnicodeToGlyphname()===
===UnicodeToGlyphname()===
get the glpyh name associated to to a unicode codepoint
get the glpyh name associated to to a unicode codepoint
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L116 textlayout/lib/I2CE_Encoding.php] on line 116
*Signature: public function UnicodeToGlyphname($in)
*Signature: public function UnicodeToGlyphname($in)
*Parameters:
*Parameters:
Line 47: Line 56:
===__construct()===
===__construct()===
@param string $encoding_type -- set to the encoding used needs to be  one of PHP multibyte strings encodings
@param string $encoding_type -- set to the encoding used needs to be  one of PHP multibyte strings encodings
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L35 textlayout/lib/I2CE_Encoding.php] on line 35
*Signature: public function __construct($mb_encoding)
*Signature: public function __construct($mb_encoding)
*Parameters:
*Parameters:
Line 52: Line 62:
===changeGlyphNames()===
===changeGlyphNames()===
Change the glyph names @param $names an associative array with the new value being the value and the old value being the key
Change the glyph names @param $names an associative array with the new value being the value and the old value being the key
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L173 textlayout/lib/I2CE_Encoding.php] on line 173
*Signature: public function changeGlyphNames($names)
*Signature: public function changeGlyphNames($names)
*Parameters:
*Parameters:
Line 57: Line 68:
===fixEuro()===
===fixEuro()===
Make sure U+20AC has the glyphname euro if it exists in this encoding
Make sure U+20AC has the glyphname euro if it exists in this encoding
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L187 textlayout/lib/I2CE_Encoding.php] on line 187
*Signature: public function fixEuro()
*Signature: public function fixEuro()
===getEncodingType()===
===getEncodingType()===
Get the unicode encoding to use
Get the unicode encoding to use
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L74 textlayout/lib/I2CE_Encoding.php] on line 74
*Signature: public function getEncodingType()
*Signature: public function getEncodingType()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>$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
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L148 textlayout/lib/I2CE_Encoding.php] on line 148
*Signature: public function readMap($enc_file)
*Signature: public function readMap($enc_file)
*Parameters:
*Parameters:
Line 69: Line 83:
===setCharacterCode()===
===setCharacterCode()===
Set the character code assoicated to a unicode code point
Set the character code assoicated to a unicode code point
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L136 textlayout/lib/I2CE_Encoding.php] on line 136
*Signature: public function setCharacterCode($cp,$cc)
*Signature: public function setCharacterCode($cp,$cc)
*Parameters:
*Parameters:
Line 74: Line 89:
** [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()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L44 textlayout/lib/I2CE_Encoding.php] on line 44
*Signature: protected function setEncodingType($mb_encoding)
*Signature: protected function setEncodingType($mb_encoding)
*Parameters:
*Parameters:
Line 79: Line 95:
===setGlyphname()===
===setGlyphname()===
Set the gylph name of a character
Set the gylph name of a character
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L127 textlayout/lib/I2CE_Encoding.php] on line 127
*Signature: public function setGlyphname($cp,$gn)
*Signature: public function setGlyphname($cp,$gn)
*Parameters:
*Parameters:
Line 84: Line 101:
** [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()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/textlayout/4.0.2-release/annotate/head:/lib/I2CE_Encoding.php#L65 textlayout/lib/I2CE_Encoding.php] on line 65
*Signature: public function useMB()
*Signature: public function useMB()




[[Category:Class Documentation]]
[[Category:Class Documentation]]

Revision as of 09:49, 10 November 2009

This article describes 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

$encoding

$mb_encoding

protected @var string $unicode_encoding

$useMB

$fix

Some common incorrect glyph names

Methods

UnicodeFromCharactercode()

get the multibyte character associated to a character code

UnicodeFromGlyphname()

get the multibyte character associated to a glyphname

UnicodeToCharacterCode()

get the character code to a unicode codepoint

UnicodeToGlyphname()

get the glpyh name associated to to a unicode codepoint

__construct()

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

changeGlyphNames()

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

fixEuro()

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

getEncodingType()

Get the unicode encoding to use

readMap()

Read in a character encoding from a file

  • Defined in textlayout/lib/I2CE_Encoding.php on line 148
  • 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

setEncodingType()

setGlyphname()

Set the gylph name of a character

useMB()