Font Database

@sutton-signwriting/font-db

Gitter version npm downloads

SignWriting

@sutton-signwriting/font-db is a javascript package for node that generates SVG and PNG images for individual symbols and complete signs. The package covers the entire set of the International SignWritnig Alphabet 2010 (ISWA 2010).

This package supports both Formal SignWriting in ASCII (FSW) and SignWriting in Unicode (SWU) character sets, along with the style string. See draft-slevinski-formal-signwriting for detailed specification.

Useful links

Install in existing NPM package

    npm install @sutton-signwriting/font-db

Install Font Database Package as stand-alone

    # download package
    git clone https://github.com/sutton-signwriting/font-db.git

    # install dependancies
    cd font-db
    npm install

    # test project
    npm run test

    # create project documentation
    npm run docs

    # start built-in server
    npm run server

Usage

Using in code

    // import entire library
    const fontDb = require('@sutton-signwriting/font-db);

    // import individual module
    const fsw = require('@sutton-signwriting/font-db/fsw);

Using on the commad line

    # works for script with FSW and SWU, Symbol and Sign, SVG and PNG.

    # output in the terminal
    node fsw/fsw-sign-svg M525x535S2e748483x510S10011501x466S2e704510x500S10019476x475-C

    # save to file
    node fsw/fsw-sign-svg M525x535S2e748483x510S10011501x466S2e704510x500S10019476x475-C output.svg

License

MIT

SignWriting General Interest

fsw

The fsw module contains functions for handling Formal SignWriitng in ASCII (FSW) characters. FSW characters definition

fsw

fsw.symbolSvg

Function that creates an SVG image from an FSW symbol key with an optional style string

fsw.symbolSvg(fswSym: string, callback: function)
Parameters
fswSym (string) an FSW symbol key with optional style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is '<svg...")
  }
}

fsw.symbolSvg('S10000', callback )

fsw.symbolPng

Function that creates a binary PNG image from an FSW symbol key with an optional stle string

fsw.symbolPng(fswSym: string, callback: function)
Parameters
fswSym (string) an FSW symbol key with optional style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is '<Buffer 89 50 4e 47...")
  }
}

fsw.symbolPng('S10000', callback )

fsw.symbolPngDataUrl

Function that creates a data url PNG image from an FSW symbol key with an optional stle string

fsw.symbolPngDataUrl(fswSym: string, callback: function)
Parameters
fswSym (string) an FSW symbol key with optional style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is 'data:image/png;base64,iVBORw...")
  }
}

fsw.symbolPndDataUrl('S10000', callback )

fsw.symbolNormalize

Function that normalizes a symbol with a minimum coordinate for a center of 500,500

fsw.symbolNormalize(fswSym: string, callback: function)
Parameters
fswSym (string) an FSW symbol key with optional coordinate and style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is 'S20500495x495-C'")
  }
}

fsw.symbolNormalize('S20500-C', callback )

fsw.signSvg

Function that creates an SVG image from an FSW sign with an optional style string

fsw.signSvg(fswSign: string, callback: function)
Parameters
fswSign (string) an FSW sign with optional style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is '<svg...")
  }
}

fsw.signSvg('M525x535S2e748483x510S10011501x466S2e704510x500S10019476x475', callback )

fsw.signPng

Function that creates a binary PNG image from an FSW sign with an optional style string

fsw.signPng(fswSign: string, callback: function)
Parameters
fswSign (string) an FSW sign with optional style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is '<Buffer 89 50 4e 47...")
  }
}

fsw.signPng('M525x535S2e748483x510S10011501x466S20544510x500S10019476x475', callback )

fsw.signPngDataUrl

Function that creates a data url PNG image from an FSW sign with an optional style string

fsw.signPngDataUrl(fswSign: string, callback: function)
Parameters
fswSign (string) an FSW sign with optional style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is 'data:image/png;base64,iVBORw...")
  }
}

fsw.signPngDataUrl('M525x535S2e748483x510S10011501x466S20544510x500S10019476x475', callback )

fsw.signNormalize

Function that normalizes an FSW sign for a center of 500,500

fsw.signNormalize(fswSign: string, callback: function)
Parameters
fswSign (string) an FSW sign with optional style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is 'M525x535S2e748483x510S10011501x466S2e704510x500S10019476x475'")
  }
}

fsw.signNormalize('M525x535S2e748483x510S10011501x466S2e704510x500S10019476x475', callback )

swu

The swu module contains functions for handling Formal SignWriitng in ASCII (SWU) characters. SWU characters definition

swu

swu.symbolSvg

Function that creates an SVG image from an SWU symbol key with an optional style string

swu.symbolSvg(swuSym: string, callback: function)
Parameters
swuSym (string) an SWU symbol key with optional style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is '<svg...")
  }
}

swu.symbolSvg('񀀁', callback )

swu.symbolPng

Function that creates a binary PNG image from an SWU symbol key with an optional stle string

swu.symbolPng(swuSym: string, callback: function)
Parameters
swuSym (string) an SWU symbol key with optional style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is '<Buffer 89 50 4e 47...")
  }
}

swu.symbolPng('񀀁', callback )

swu.symbolPngDataUrl

Function that creates a data url PNG image from an SWU symbol key with an optional stle string

swu.symbolPngDataUrl(swuSym: string, callback: function)
Parameters
swuSym (string) an SWU symbol key with optional style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is 'data:image/png;base64,iVBORw...")
  }
}

swu.symbolPndDataUrl('񀀁', callback )

swu.symbolNormalize

Function that normalizes a symbol with a minimum coordinate for a center of 500,500

swu.symbolNormalize(swuSym: string, callback: function)
Parameters
swuSym (string) an SWU symbol with optional coordinate and style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is '񆇡𝤁𝤁-C'")
  }
}

swu.symbolNormalize('񆇡-C', callback )

swu.signSvg

Function that creates an SVG image from an SWU sign with an optional style string

swu.signSvg(swuSign: string, callback: function)
Parameters
swuSign (string) an SWU sign with optional style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is '<svg...")
  }
}

swu.signSvg('𝠃𝤟𝤩񋛩𝣵𝤐񀀒𝤇𝣤񋚥𝤐𝤆񀀚𝣮𝣭', callback )

swu.signPng

Function that creates a binary PNG image from an SWU sign with an optional style string

swu.signPng(swuSign: string, callback: function)
Parameters
swuSign (string) an SWU sign with optional style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is '<Buffer 89 50 4e 47...")
  }
}

swu.signPng('𝠃𝤟𝤩񋛩𝣵𝤐񀀒𝤇𝣤񆈥𝤐𝤆񀀚𝣮𝣭', callback )

swu.signPngDataUrl

Function that creates a data url PNG image from an SWU sign with an optional style string

swu.signPngDataUrl(swuSign: string, callback: function)
Parameters
swuSign (string) an SWU sign with optional style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is 'data:image/png;base64,iVBORw...")
  }
}

swu.signPngDataUrl('𝠃𝤟𝤩񋛩𝣵𝤐񀀒𝤇𝣤񆈥𝤐𝤆񀀚𝣮𝣭', callback )

swu.signNormalize

Function that normalizes an SWU sign for a center of 500,500

swu.signNormalize(swuSign: string, callback: function)
Parameters
swuSign (string) an SWU sign with optional style string
callback (function) a callback function with error and result parameters
Example
const callback = (error, result) => {
  if (error) {
    console.log(error)
  } else {
    console.log(result + " is '𝠃𝤟𝤩񋛩𝣵𝤐񀀒𝤇𝣤񋚥𝤐𝤆񀀚𝣮𝣭'")
  }
}

swu.signNormalize('𝠃𝤟𝤩񋛩𝣵𝤐񀀒𝤇𝣤񋚥𝤐𝤆񀀚𝣮𝣭', callback )