Class

ScriptInfo

ScriptInfo(script, optionsopt)

Create a new script info instance. This class encodes information about scripts, which are sets of characters used in a writing system.

The options object may contain any of the following properties:

  • onLoad - a callback function to call when the script info object is fully loaded. When the onLoad option is given, the script info object will attempt to load any missing locale data using the ilib loader callback. When the constructor is done (even if the data is already preassembled), the onLoad function is called with the current instance as a parameter, so this callback can be used with preassembled or dynamic loading or a mix of the two.
  • sync - tell whether to load any missing locale data synchronously or asynchronously. If this option is given as "false", then the "onLoad" callback must be given, as the instance returned from this constructor will not be usable for a while.
  • loadParams - an object containing parameters to pass to the loader callback function when locale data is missing. The parameters are not interpretted or modified in any way. They are simply passed along. The object may contain any property/value pairs as long as the calling code is in agreement with the loader callback function as to what those parameters mean.
Constructor

# new ScriptInfo(script, optionsopt)

Parameters:
Name Type Attributes Description
script string

The ISO 15924 4-letter identifier for the script

options Object <optional>

parameters to initialize this instance

View Source ScriptInfo.js, line 57

Methods

# getCasing() → {boolean}

Return true if this script uses lower- and upper-case characters.

View Source ScriptInfo.js, line 216

true if this script uses letter case

boolean

# getCode() → {string}

Return the 4-letter ISO 15924 identifier associated with this script.

View Source ScriptInfo.js, line 157

the 4-letter ISO code for this script

string

# getCodeNumber() → {number}

Get the ISO 15924 code number associated with this script.

View Source ScriptInfo.js, line 167

the ISO 15924 code number

number

# getLongCode() → {string}

Get the long identifier assciated with this script.

View Source ScriptInfo.js, line 185

the long identifier of this script

string

# getName() → {string}

Get the name of this script in English.

View Source ScriptInfo.js, line 176

the name of this script in English

string

# getNeedsIME() → {boolean}

Return true if this script typically requires an input method engine to enter its characters.

View Source ScriptInfo.js, line 207

true if this script typically requires an IME

boolean

# getScriptDirection() → {string}

Return the usual direction that text in this script is written in. Possible return values are "rtl" for right-to-left, "ltr" for left-to-right, and "ttb" for top-to-bottom.

View Source ScriptInfo.js, line 197

the usual direction that text in this script is written in

string

# static getAllScripts(sync, loadParams, onLoad) → {Array.<string>}

Return an array of all ISO 15924 4-letter identifier script identifiers that this copy of ilib knows about.

Parameters:
Name Type Description
sync boolean

whether to find the available ids synchronously (true) or asynchronously (false)

loadParams Object

arbitrary object full of properties to pass to the loader

onLoad function

callback function to call when the data is finished loading

View Source ScriptInfo.js, line 126

an array of all script identifiers that this copy of ilib knows about

Array.<string>