PHP Class Mike42\Escpos\CodePage

Also computes map between UTF-8 and this encoding if necessary, using the iconv library.
Datei anzeigen Open project: mike42/escpos-php Class Usage Examples

Protected Properties

Property Type Description
$data string Data string, null if not known (can be computed with iconv)
$iconv string Iconv encoding name, null if not known
$id string Internal ID of the CodePage
$name string Name of the code page. Substituted with the ID if not set.
$notes string Notes on this code page, or null if not set.

Public Methods

Method Description
__construct ( string $id, array $codePageData )
getData ( ) : string Get a 128-character data string representing this encoding.
getIconv ( ) : string
getId ( ) : string
getName ( ) Name of the code page.
getNotes ( ) : string The notes may explain quirks about a code-page, such as a source if it's non-standard or un-encodeable.
isEncodable ( ) : boolean

Protected Methods

Method Description
generateEncodingMap ( string $iconvName ) : string Given an iconv encoding name, generate a 128-character UTF-8 string, containing code points 128-255.

Method Details

__construct() public method

public __construct ( string $id, array $codePageData )
$id string Unique internal identifier for the CodePage.
$codePageData array Associative array of CodePage data, as specified by the upstream receipt-print-hq/escpos-printer-db database. May contain 'name', 'data', 'iconv', and 'notes' fields.

generateEncodingMap() protected static method

This string is used to map UTF-8 characters to their location in this code page.
protected static generateEncodingMap ( string $iconvName ) : string
$iconvName string Name of the encoding
return string 128-character string in UTF-8.

getData() public method

It will be calculated and cached if it was not previously known.
public getData ( ) : string
return string Data for this encoding.

getIconv() public method

public getIconv ( ) : string
return string Iconv encoding name, or blank if not set.

getId() public method

public getId ( ) : string
return string Unique identifier of the code page.

getName() public method

Name of the code page.
public getName ( )

getNotes() public method

The notes may explain quirks about a code-page, such as a source if it's non-standard or un-encodeable.
public getNotes ( ) : string
return string Notes on the code page, or null if not set.

isEncodable() public method

public isEncodable ( ) : boolean
return boolean True if we can encode with this code page (ie, we know what data it holds). Many printers contain vendor-specific code pages, which are named but have not been identified or typed out. For our purposes, this is an "un-encodeable" code page.

Property Details

$data protected_oe property

Data string, null if not known (can be computed with iconv)
protected string $data
return string

$iconv protected_oe property

Iconv encoding name, null if not known
protected string $iconv
return string

$id protected_oe property

Internal ID of the CodePage
protected string $id
return string

$name protected_oe property

Name of the code page. Substituted with the ID if not set.
protected string $name
return string

$notes protected_oe property

Notes on this code page, or null if not set.
protected string $notes
return string