escpos-php
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | Static Protected Member Functions | Protected Attributes | List of all members
Mike42\Escpos\CodePage Class Reference

Public Member Functions

 __construct ($id, array $codePageData)
 
 getData ()
 
 getIconv ()
 
 getId ()
 
 getName ()
 
 getNotes ()
 
 isEncodable ()
 

Public Attributes

const INPUT_ENCODING = "UTF-8"
 

Static Protected Member Functions

static generateEncodingMap ($iconvName)
 

Protected Attributes

 $data
 
 $iconv
 
 $id
 
 $name
 
 $notes
 

Detailed Description

Class to handle data about a particular CodePage, as loaded from the receipt print database.

Also computes map between UTF-8 and this encoding if necessary, using the iconv library.

Constructor & Destructor Documentation

Mike42\Escpos\CodePage::__construct (   $id,
array  $codePageData 
)
Parameters
string$idUnique internal identifier for the CodePage.
array$codePageDataAssociative array of CodePage data, as specified by the upstream receipt-print-hq/escpos-printer-db database. May contain 'name', 'data', 'iconv', and 'notes' fields.

Member Function Documentation

static Mike42\Escpos\CodePage::generateEncodingMap (   $iconvName)
staticprotected

Given an iconv encoding name, generate a 128-character UTF-8 string, containing code points 128-255.

This string is used to map UTF-8 characters to their location in this code page.

Parameters
string$iconvNameName of the encoding
Returns
string 128-character string in UTF-8.
Mike42\Escpos\CodePage::getData ( )

Get a 128-character data string representing this encoding. It will be calculated and cached if it was not previously known.

Exceptions
InvalidArgumentExceptionWhere the data is now known or computable.
Returns
string Data for this encoding.
Mike42\Escpos\CodePage::getIconv ( )
Returns
string Iconv encoding name, or blank if not set.
Mike42\Escpos\CodePage::getId ( )
Returns
string Unique identifier of the code page.
Mike42\Escpos\CodePage::getName ( )

Name of the code page.

Mike42\Escpos\CodePage::getNotes ( )

The notes may explain quirks about a code-page, such as a source if it's non-standard or un-encodeable.

Returns
string Notes on the code page, or null if not set.
Mike42\Escpos\CodePage::isEncodable ( )
Returns
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.

Member Data Documentation

string Mike42\Escpos\CodePage::$data
protected

Data string, null if not known (can be computed with iconv)

string Mike42\Escpos\CodePage::$iconv
protected

Iconv encoding name, null if not known

string Mike42\Escpos\CodePage::$id
protected

Internal ID of the CodePage

string Mike42\Escpos\CodePage::$name
protected

Name of the code page. Substituted with the ID if not set.

string Mike42\Escpos\CodePage::$notes
protected

Notes on this code page, or null if not set.

const Mike42\Escpos\CodePage::INPUT_ENCODING = "UTF-8"

The input encoding for generating character maps with iconv.


The documentation for this class was generated from the following file: