SWU
SignWriting in Unicode (SWU) parsing, composition, and helpers.
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
| Parameter | Type |
|---|---|
swu_char | string |
type_name | string |
Returns
bool
Examples
\Sgnw\Core\Swu\swu_is_type('ń', 'hand'); // trueSgnw\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
| Parameter | Type |
|---|---|
sym | string |
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
| Parameter | Type |
|---|---|
swu_sym | string |
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
| Parameter | Type |
|---|---|
swu_sign | string |
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
| Parameter | Type |
|---|---|
swu_text | string |
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
| Parameter | Type |
|---|---|
swu_sym_object | array |
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
| Parameter | Type |
|---|---|
swu_sign_object | array |
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
| Parameter | Type |
|---|---|
swu | string |
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
| Parameter | Type |
|---|---|
options | array|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
| Parameter | Type |
|---|---|
swu_text | string |
options | array|null |
Returns
array
Examples
\Sgnw\Core\Swu\swu_columns('đ ńČĄń©§đ đ€đ€ŁńČĄđŁłđŁ©ń©§đ€đŁ» đ ńąń«ńńĄđ đ€đ€§ń«đŁ»đ€ńąđŁŽđŁŒńĄđ€đ€ńđ€đŁŠ ńđŁąđ€', ['height' => 500, 'width' => 150]);