Class ScriptInfo
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.
Defined in: ScriptInfo.js.
Constructor Attributes | Constructor Name and Description |
---|---|
ScriptInfo(script, options)
|
Method Attributes | Method Name and Description |
---|---|
<static> |
ScriptInfo.getAllScripts(sync, loadParams, onLoad)
Return an array of all ISO 15924 4-letter identifier script identifiers that
this copy of ilib knows about.
|
Return true if this script uses lower- and upper-case characters.
|
|
getCode()
Return the 4-letter ISO 15924 identifier associated
with this script.
|
|
Get the ISO 15924 code number associated with this
script.
|
|
Get the long identifier assciated with this script.
|
|
getName()
Get the name of this script in English.
|
|
Return true if this script typically requires an input method engine
to enter its characters.
|
|
Return the usual direction that text in this script is written
in.
|
Class Detail
ScriptInfo(script, options)
- Parameters:
- {string} script
- The ISO 15924 4-letter identifier for the script
- {Object=} options
- parameters to initialize this instance
Method Detail
<static>
{Array.}
ScriptInfo.getAllScripts(sync, loadParams, onLoad)
Return an array of all ISO 15924 4-letter identifier script identifiers that
this copy of ilib knows about.
- Parameters:
- {boolean} sync
- whether to find the available ids synchronously (true) or asynchronously (false)
- {Object} loadParams
- arbitrary object full of properties to pass to the loader
-
{function(Array.
)} onLoad - callback function to call when the data is finished loading
- Returns:
- {Array.
} an array of all script identifiers that this copy of ilib knows about
{boolean}
getCasing()
Return true if this script uses lower- and upper-case characters.
- Returns:
- {boolean} true if this script uses letter case
{string}
getCode()
Return the 4-letter ISO 15924 identifier associated
with this script.
- Returns:
- {string} the 4-letter ISO code for this script
{number}
getCodeNumber()
Get the ISO 15924 code number associated with this
script.
- Returns:
- {number} the ISO 15924 code number
{string}
getLongCode()
Get the long identifier assciated with this script.
- Returns:
- {string} the long identifier of this script
{string}
getName()
Get the name of this script in English.
- Returns:
- {string} the name of this script in English
{boolean}
getNeedsIME()
Return true if this script typically requires an input method engine
to enter its characters.
- Returns:
- {boolean} true if this script typically requires an IME
{string}
getScriptDirection()
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.
- Returns:
- {string} the usual direction that text in this script is written in