SWU

SignWriting in Unicode (SWU) parsing, composition, and helpers.

Source

Functions

Sgnw\Core\Swu\swu_structure_kind

function swu_structure_kind()

The swu module contains functions for handling SignWriting in Unicode (SWU) characters.

SWU characters definition:
https://datatracker.ietf.org/doc/id/draft-slevinski-formal-signwriting-10.html#name-signwriting-in-unicode-swu

Sgnw\Core\Swu\swu_structure_category

function swu_structure_category()

Sgnw\Core\Swu\swu_structure_group

function swu_structure_group()

Sgnw\Core\Swu\swu_structure_ranges

function swu_structure_ranges()

Sgnw\Core\Swu\swu_is_type

function swu_is_type($swu_char, $type_name)

Test whether an SWU character is of the given type/range.

Parameters

ParameterType
swu_charstring
type_namestring

Returns

bool

Examples

\Sgnw\Core\Swu\swu_is_type('񀀁', 'hand'); // true

Sgnw\Core\Swu\swu_colors

function swu_colors()

Sgnw\Core\Swu\swu_colorize

function swu_colorize($sym)

Function that returns the standardized color for a symbol.

Parameters

ParameterType
symstring

Returns

string

Examples

\Sgnw\Core\Swu\swu_colorize('񀀁'); // '#0000CC'

Sgnw\Core\Swu\swu_parse_symbol

function swu_parse_symbol($swu_sym)

Parse an SWU symbol with optional coordinate and style string.

Parameters

ParameterType
swu_symstring

Returns

array

Examples

\Sgnw\Core\Swu\swu_parse_symbol('ń€€đ€†đ€†-C');
// ['symbol' => '񀀁', 'coord' => [500, 500], 'style' => '-C']

Sgnw\Core\Swu\swu_parse_sign

function swu_parse_sign($swu_sign)

Parse an SWU sign with optional style string.

Parameters

ParameterType
swu_signstring

Returns

array

Examples

\Sgnw\Core\Swu\swu_parse_sign('𝠀ń€€’ń€€šń‹š„ń‹›©đ ƒđ€Ÿđ€©ń‹›©đŁ”đ€ń€€’đ€‡đŁ€ń‹š„đ€đ€†ń€€šđŁźđŁ­-C');

Sgnw\Core\Swu\swu_parse_text

function swu_parse_text($swu_text)

Parse an SWU text into signs and punctuations.

Parameters

ParameterType
swu_textstring

Returns

array

Examples

\Sgnw\Core\Swu\swu_parse_text('𝠀ńČĄńˆ©§đ ƒđ€˜đ€ŁńČĄđŁłđŁ©ńˆ©§đ€‰đŁ» 𝠀ńƒŠąńƒŠ«ń‹›•ń†‡Ąđ ƒđ€˜đ€§ńƒŠ«đŁ»đ€•ńƒŠąđŁŽđŁŒń†‡Ąđ€Žđ€‚ń‹›•đ€†đŁŠ ńŒđŁąđ€‚');

Sgnw\Core\Swu\swu_compose_symbol

function swu_compose_symbol($swu_sym_object)

Function to compose an swu symbol with optional coordinate and style string.

Parameters

ParameterType
swu_sym_objectarray

Returns

string|null

Examples

\Sgnw\Core\Swu\swu_compose_symbol(['symbol' => '񀀁', 'coord' => [500, 500], 'style' => '-C']);

Sgnw\Core\Swu\swu_compose_sign

function swu_compose_sign($swu_sign_object)

Function to compose an swu sign with style string.

Parameters

ParameterType
swu_sign_objectarray

Returns

string|null

Examples

\Sgnw\Core\Swu\swu_compose_sign([
  'sequence' => ['񀀒','񀀚','񋚄','񋛩'],
  'box' => '𝠃',
  'max' => [525, 535],
  'spatials' => [
    ['symbol' => 'ń‹›©', 'coord' => [483, 510]],
    ['symbol' => '񀀒', 'coord' => [501, 466]],
    ['symbol' => 'ń‹š„', 'coord' => [510, 500]],
    ['symbol' => '񀀚', 'coord' => [476, 475]]
  ],
  'style' => '-C'
]);

Sgnw\Core\Swu\swu_info

function swu_info($swu)

Function to gather sizing information about an swu sign or symbol.

Parameters

ParameterType
swustring

Returns

array

Examples

\Sgnw\Core\Swu\swu_info('𝠀ńČĄńˆ©§đ ‚đ€˜đ€ŁńČĄđŁłđŁ©ńˆ©§đ€‰đŁ»-P10Z2');

Sgnw\Core\Swu\array_map

function array_map(function ($spatial) { return $spatial['coord'][1]; }, $parsed_sign['spatials'])

Sgnw\Core\Swu\min

function min($x_coords)

Sgnw\Core\Swu\swu_column_defaults

function swu_column_defaults()

Sgnw\Core\Swu\swu_column_defaults_merge

function swu_column_defaults_merge($options = null)

Function to merge an object of column options with default values.

Parameters

ParameterType
optionsarray|null

Returns

array

Examples

\Sgnw\Core\Swu\swu_column_defaults_merge(['height' => 500, 'width' => 150]);

Sgnw\Core\Swu\swu_columns

function swu_columns($swu_text, $options = null)

Function to transform an SWU text to an array of columns.

Parameters

ParameterType
swu_textstring
optionsarray|null

Returns

array

Examples

\Sgnw\Core\Swu\swu_columns('𝠀ńČĄńˆ©§đ ƒđ€˜đ€ŁńČĄđŁłđŁ©ńˆ©§đ€‰đŁ» 𝠀ńƒŠąńƒŠ«ń‹›•ń†‡Ąđ ƒđ€˜đ€§ńƒŠ«đŁ»đ€•ńƒŠąđŁŽđŁŒń†‡Ąđ€Žđ€‚ń‹›•đ€†đŁŠ ńŒđŁąđ€‚', ['height' => 500, 'width' => 150]);