SignWriting in Unicode 8 (uni8)

@sutton-signwriting/unicode8

Gitter version npm downloads

@sutton-signwriting/unicode8 is a javascript package for processing SignWriting in Unicode 8 (uni8) characters. See SignWriting#Unicode for more information about the characters and notofont/sign-writing for more information about the Unicode compliant font.

This package also supports Formal SignWriting in ASCII (FSW) and SignWriting in Unicode (SWU) character sets. See draft-slevinski-formal-signwriting for detailed specification.

Author: https://SteveSlevinski.me
Channel: https://www.youtube.com/channel/UCXu4AXlG0rXFtk_5SzumDow
Support: https://www.patreon.com/signwriting
Donate: https://donate.sutton-signwriting.io

Useful links

Types of files

The source is written in small ES Modules available in the src directory along with the associated tests.

The distribution is available in three flavors. Minified, the whole library is 2 KB in size.

  • .js - Universal Module Definition
  • .cjs - CommonJS
  • .mjs - ES Module

Installation

Download and Install with NPM

npm install @sutton-signwriting/unicode8

Developer Installation

Download from GitHub and Install Development Dependencies

wget https://github.com/sutton-signwriting/unicode8/archive/master.zip
unzip master.zip
cd unicode8-master
npm install

Usage

Using in Node

// import entire library
const unicode8 = require('@sutton-signwriting/unicode8');

// import individual module
const unicode8Symbol = require('@sutton-signwriting/unicode8/symbol');

Using in the Browser

Local files

// import entire library
// available as ssw.unicode8
<script src="unicode8.js"></script>

// import individual module
// available as ssw.unicode8.symbol
<script src="symbol/symbol.js"></script>

Unpkg

// import entire library
// available as ssw.unicode8
<script src="https://unpkg.com/@sutton-signwriting/unicode8@1.1.0"></script>

// import individual module
// available as ssw.unicode8.font
<script src="https://unpkg.com/@sutton-signwriting/unicode8@1.1.0/font/font.js"></script>

License

MIT

SignWriting General Interest

font

The font module contains functions for handing the font.

font

font.cssAppend

Function that appends font-face CSS for the Noto Sans SignWriting font for use with SignWriting in Unicode 8 (uni8) characters.

This font-face declaration will use a locally installed font if available. If not found, the font will be loaded from a content delivery network.

The list of local names is currently a work in progress. The font-face currently works for Windows and iOS. This CSS is duplicated in the src/font/index.css file.

font.cssAppend(dir: string)
Parameters
dir (string) an optional relative directory for font location
Example
font.cssAppend('./font/')

symbol

The symbol module contains regular expressions and functions for parsing and composing SignWriting in Unicode 8 (uni8) characters.

symbol

symbol.re

Object of regular expressions for symbol strings

{ base, fill, rotation, full }

symbol.re

Type: object

symbol.parse

Function to parse symbol string to object

symbol.parse(symbolString: string): object
Parameters
symbolString (string) a symbol string
Returns
object: elements of symbol string
Example
symbol.parse('𝠀')

return {
 'base': '𝠀',
 'fill': undefined,
 'rotation': undefined
}

symbol.compose

Function to compose symbol string from object

symbol.compose(symbolObject: object): string
Parameters
symbolObject (object) an object of symbol parts
Name Description
symbolObject.base string base character for symbol
symbolObject.fill string fill character for symbol
symbolObject.rotation string rotation character for symbol
Returns
string: symbol string
Example
symbol.compose({
 'base': '𝠀'
})

return '𝠀'

string

The string module contains regular expressions and functions for parsing and composing SignWriting in Unicode 8 (uni8) symbol strings.

string

string.re

Object of regular expressions for string of symbols

{ full }

string.re

Type: object

string.parse

Function to parse string of uni8 symbols to array

string.parse(uni8String: string): array
Parameters
uni8String (string) a string of uni8 symbols
Returns
array: array of uni8 symbols
Example
string.parse('𝠀𝠁')

return ['𝠀','𝠁']

string.compose

Function to compose uni8 string from array

string.compose(stringArray: array): string
Parameters
stringArray (array) an array of uni8 symbols
Returns
string: string of uni8 symbols
Example
string.compose(['𝠀','𝠁'])

return '𝠀𝠁'

convert

The convert module contains functions to help process the various SignWriting Character sets.

convert

convert.code2uni

Function to convert a SignWriting in Unicode 8 (uni8) code point to a character

convert.code2uni(code: integer): string
Parameters
code (integer) unicode code point
Returns
string: SignWriting in Unicode 8 character
Example
convert.code2uni(0x1D800)

return '𝠀'

convert.uni2code

Function to convert a SignWriting in Unicode 8 (uni8) character to a code point

convert.uni2code(uni8: string): integer
Parameters
uni8 (string) SignWriting in Unicode 8 character
Returns
integer: unicode code point
Example
convert.uni2code('𝠀')

return 0x1D800

convert.uni2hex

Function to convert a SignWriting in Unicode 8 (uni8) character to hex values

convert.uni2hex(uni8: string): string
Parameters
uni8 (string) SignWriting in Unicode 8 character
Returns
string: hex value of unicode character
Example
convert.uni2hex('𝠀')

return "1D800"

convert.uni2fsw

Function to convert a SignWriting in Unicode 8 (uni8) symbol to Formal SignWriting in ASCII (FSW)

convert.uni2fsw(uni8: string): string
Parameters
uni8 (string) SignWriting in Unicode 8 character(s)
Returns
string: an FSW symbol key
Example
convert.uni2fsw('𝠀')

return 'S10000'

convert.uni2swu

Function to convert a SignWriting in Unicode 8 (uni8) symbol to SignWriting in Unicode (SWU)

convert.uni2swu(uni8: string): string
Parameters
uni8 (string) SignWriting in Unicode 8 character(s)
Returns
string: an SWU symbol
Example
convert.uni2swu('𝠀')

return '񀀁'

convert.fsw2uni

Function to convert a Formal SignWriting in ASCII (FSW) to SignWriting in Unicode 8 (uni8)

convert.fsw2uni(fswSym: string): string
Parameters
fswSym (string) an FSW symbol key
Returns
string: SignWriting in Unicode 8 character(s)
Example
convert.fsw2uni('S10000')

return '𝠀'

convert.swu2uni

Function to convert a SignWriting in Unicode (SWU) to SignWriting in Unicode 8 (uni8)

convert.swu2uni(swuSym: string): string
Parameters
swuSym (string) an SWU symbol
Returns
string: SignWriting in Unicode 8 character(s)
Example
convert.swu2uni('񀀁')

return '𝠀'