getDefaultScriptName method

dynamic getDefaultScriptName()

Returns the best bet for a script name. Returns 'DFLT' if it exists. If not, returns 'latn' if it exists. If neither exist, returns undefined.

Implementation

getDefaultScriptName() {
    var layout = this.getTable(false);
    if (layout == null) { return; }
    var hasLatn = false;
    for (var i = 0; i < layout["scripts"].length; i++) {
        var name = layout["scripts"][i]["tag"];
        if (name == 'DFLT') return name;
        if (name == 'latn') hasLatn = true;
    }
    if (hasLatn) return 'latn';
}