Table of contents
Namespace: Com\Tecnick\Barcode\Type\Square\Datamatrix
Extends: EncodeTxt
File: Encode.php line 34
Encode methods for Datamatrix Barcode type class
Tags
- since: 2015-02-21
- category: Library
- author: Nicola Asuni info@tecnick.com
- copyright: 2015-2026 Nicola Asuni - Tecnick.com LTD
- license: https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
- link: https://github.com/tecnickcom/tc-lib-barcode
Properties
$gsonemode
File: Modes.php line 74
public bool $gsonemode = false
$last_enc
File: Modes.php line 57
public int $last_enc = 0
$shape
File: Modes.php line 62
public string $shape
$size
File: Modes.php line 69
public string $size = ''
Methods
__construct()
File: Encode.php line 51
public __construct([string $shape = 'S' ][, bool $gsonemode = false ][, string $size = '' ]) : mixed
Parameters
- $shape : string = ‘S’: Datamatrix shape key (S=square, R=rectangular)
- $gsonemode : bool = false: True to encode the FNC1 and GS characters as the FNC1 codeword
- $size : string = ‘’: Requested symbol size as rows by columns, empty for the smallest that fits
encodeASCII()
File: Encode.php line 68
public encodeASCII(array<int, int> &$cdw, int &$cdw_num, int &$pos, int &$data_length, string &$data, int &$enc) : void
Parameters
- $cdw : array<int, int>: Codewords array
- $cdw_num : int: Codewords number
- $pos : int: Current position
- $data_length : int: Data length
- $data : string: Data string
- $enc : int: Current encoding
encodeBase256()
File: Encode.php line 292
public encodeBase256(array<int, int> &$cdw, int &$cdw_num, int &$pos, int &$data_length, int &$field_length, string &$data, int &$enc) : void
Parameters
- $cdw : array<int, int>: Codewords array
- $cdw_num : int: Codewords number
- $pos : int: Current position
- $data_length : int: Data length
- $field_length : int: Field length
- $data : string: Data string
- $enc : int: Current encoding
encodeEDF()
File: Encode.php line 250
public encodeEDF(array<int, int> &$cdw, int &$cdw_num, int &$pos, int &$data_length, int &$field_length, string &$data, int &$enc) : void
Parameters
- $cdw : array<int, int>: Codewords array
- $cdw_num : int: Codewords number
- $pos : int: Current position
- $data_length : int: Data length
- $field_length : int: Field length
- $data : string: Data string
- $enc : int: Current encoding
encodeEDFfour()
File: Encode.php line 168
public encodeEDFfour(int $epos, array<int, int> &$cdw, int &$cdw_num, int &$pos, int &$data_length, int &$field_length, int &$enc, array<int, int> &$temp_cw, string $data) : bool
Parameters
- $epos : int: Current position
- $cdw : array<int, int>: Codewords array
- $cdw_num : int: Codewords number
- $pos : int: Current position
- $data_length : int: Data length
- $field_length : int: Field length
- $enc : int: Current encoding
- $temp_cw : array<int, int>: Temporary codewords array
- $data : string: Data string
Tags
- throws: Exception in case of error
Return values
bool —
true to break the loop
encodeTXT()
File: EncodeTxt.php line 297
public encodeTXT(array<int, int> &$cdw, int &$cdw_num, int &$pos, int &$data_length, string &$data, int &$enc) : void
Parameters
- $cdw : array<int, int>: Codewords array
- $cdw_num : int: Codewords number
- $pos : int: Current position
- $data_length : int: Data length
- $data : string: Data string
- $enc : int: Current encoding
Tags
- throws: Exception in case of TXT/C40 encoding errors
encodeTXTC40()
File: EncodeTxt.php line 171
public encodeTXTC40(string &$data, int &$enc, array<int, int> &$temp_cw, int &$ptr, int &$epos, array<int|string, int> &$charset) : int|null
Parameters
- $data : string: Data string
- $enc : int: Current encoding
- $temp_cw : array<int, int>: Temporary codewords array
- $ptr : int: Pointer
- $epos : int: End position
- $charset : array<int|string, int>: Charset array
Tags
- throws: Exception in case of TXT/C40 encoding errors
Return values
int|null —
Current character code, or null if it has no representation in $enc
encodeTXTC40last()
File: EncodeTxt.php line 227
public encodeTXTC40last(int|null $chr, array<int, int> &$cdw, int &$cdw_num, int &$enc, array<int, int> &$temp_cw, int &$ptr, int &$epos, int $cpos) : void
Parameters
- $chr : int|null: Character code, or null if the pending values do not hold a whole character
- $cdw : array<int, int>: Codewords array
- $cdw_num : int: Codewords number
- $enc : int: Current encoding
- $temp_cw : array<int, int>: Temporary codewords array
- $ptr : int: Pointer
- $epos : int: End position
- $cpos : int: Data index of the character that owns the first pending value
encodeTXTC40shift()
File: EncodeTxt.php line 111
public encodeTXTC40shift(int &$chr, int &$enc, array<int, int> &$temp_cw, int &$ptr) : bool
Parameters
- $chr : int: Character code
- $enc : int: Current encoding
- $temp_cw : array<int, int>: Temporary codewords array
- $ptr : int: Pointer
Tags
- throws: Exception in case of shift encoding errors
Return values
bool —
false if the character has no representation in the current encoding
get253StateCodeword()
File: Modes.php line 93
public get253StateCodeword(int $cdwpad, int $cdwpos) : int
Parameters
- $cdwpad : int: Pad codeword.
- $cdwpos : int: Number of data codewords from the beginning of encoded data.
Return values
int
getPlacementMap()
File: Placement.php line 289
public getPlacementMap(int $nrow, int $ncol) : array<int, int>
(Annex F - ECC 200 symbol character placement)
Parameters
- $nrow : int: Number of rows.
- $ncol : int: Number of columns.
Return values
array<int, int>
getSwitchEncodingCodeword()
File: Modes.php line 263
public getSwitchEncodingCodeword(int $mode) : int
Parameters
- $mode : int: New encoding mode.
Return values
int —
Switch codeword.
isGsOneChar()
File: Modes.php line 82
public isGsOneChar(int $chr) : bool
Only meaningful when the GS1 variant is selected.
Parameters
- $chr : int: Character (byte) to check.
Return values
bool
lookAheadTest()
File: Steps.php line 45
public lookAheadTest(string $data, int $pos, int $mode) : int
Parameters
- $data : string: Data to encode
- $pos : int: Current position
- $mode : int: Current encoding mode
Return values
int —
encoding mode