EncodeTxt

Encode TXT/C40 methods for Datamatrix Barcode type class

Namespace: Com\Tecnick\Barcode\Type\Square\Datamatrix

class EncodeTxt extends Steps

Extends: Steps

Source: src/Type/Square/Datamatrix/EncodeTxt.php:36

Encode TXT/C40 methods for Datamatrix Barcode type class

Methods

encodeAsciiRange()

Encode a range of characters in ASCII encodation

public encodeAsciiRange(
    array<int,int> &$cdw,
    int &$cdw_num,
    string $data,
    int $from,
    int $to
): void

Parameters:

  • $cdw (array<int,int>): Codewords array
  • $cdw_num (int): Codewords number
  • $data (string): Data string
  • $from (int): First data index to encode
  • $to (int): Last data index to encode

Source: src/Type/Square/Datamatrix/EncodeTxt.php:82

encodeTXT()

Encode TXT

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

Throws:

  • Exception: in case of TXT/C40 encoding errors

Source: src/Type/Square/Datamatrix/EncodeTxt.php:297

encodeTXTC40()

Encode TXTC40

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

Returns: int|null: Current character code, or null if it has no representation in $enc

Throws:

  • Exception: in case of TXT/C40 encoding errors

Source: src/Type/Square/Datamatrix/EncodeTxt.php:171

encodeTXTC40last()

Encode TXTC40 last The following rules apply when only one or two symbol characters remain in the symbol before the start of the error correction codewords.

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

Source: src/Type/Square/Datamatrix/EncodeTxt.php:227

encodeTXTC40shift()

Encode TXTC40 shift

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

Returns: bool: false if the character has no representation in the current encoding

Throws:

Source: src/Type/Square/Datamatrix/EncodeTxt.php:111

Inherited members

From Modes

  • $gsonemode: True when the GS1 variant is selected and FNC1 separators are encoded as codeword 232.
  • $last_enc: Store last used encoding for data codewords.
  • $shape: Datamatrix shape key (S=square, R=rectangular)
  • $size: Requested symbol size as rows by columns, empty for the smallest size that fits.
  • canStartEncodation(): Returns true if the encodation can start on the character.
  • get253StateCodeword(): Return the 253-state codeword
  • getSwitchEncodingCodeword(): Get the switching codeword to a new encoding mode (latch codeword)
  • isGsOneChar(): Tell if the character is a GS1 separator: FNC1 (232) or GS (29).

From Placement

From Steps

  • lookAheadTest(): The look-ahead test scans the data to be encoded to find the best mode (Annex P - steps from J to S).