Release Notes > 12.0.0.0 > Updates in This Release > OpenType in Layout Developer > Scripts and Languages in OpenType
  
Scripts and Languages in OpenType
In order to enhance language support, OpenType supports a two-layer approach to providing groups of Feature Tables for different writing methods and the languages within them. OpenType supports a great number of scripts and languages and lists of those supported can be found in the fTypeface.OpenTypeScripts and fTypeface.OpenTypeLanguages constants. OpenType provides Feature Tables both within scripts and within the languages within each script.
As all fonts are different, and font designers can create fonts specifically for different languages and scripts, Arbortext Layout Developer provides a means to find out whether Feature Tables are available within the font. The fTypeface object in Layout Developer is the FOM representation of the font file and now provides a method to query the Feature Tables which can be used like this:
var currentFont = formatting.currentStyle.typeface;
var testFeature = fTypeface.OT_FEATURE_KERNING;
var hasFeature = currentFont.hasOpenTypeFeature(testFeature);
Used in this manner, Layout Developer will return true if the font has the Feature Table in any script and any language. formatting.currentStyle.typeface will return an fTypeface object which represents the currently active typeface file, regardless of whether pseudofonts are being used or font families.
To test whether a script and/or a language has the Feature Table, the fTypeface.hasOpenTypeFeature() method can take one or two additional arguments. The first is the script (one of fTypeface.OpenTypeScripts) and the second is the language (one of fTypeface.OpenTypeLanauges). So, to test whether the Arabic language support in a typeface has the Feature Table for the final glyph on a line of text, one would use:
var currentFont = formatting.currentStyle.font;
var testFeature = fTypeface.OT_FEATURE_FINAL_GLYPH_ON_LINE_ALTERNATES;
var testScript = fTypeface.OT_SCRIPT_ARABIC;
var testLanguage = fTypeface.OT_LANG_ARABIC;
var hasLanguageFeature = currentFont.hasOpenTypeFeature(testFeature, testScript, testLanguage);
By default, Layout Developer does not apply a script or a language. It is up to the user to ensure they select the appropriate script and/or language for their text. To do this, use the fStyle properties to set them:
var testScript = fTypeface.OT_SCRIPT_ARABIC;
var testLanguage = fTypeface.OT_LANG_ARABIC;
formatting.currentStyle.openTypeScript = testScript;
formatting.currentStyle.openTypeLanguage = testLanguage;
formatting.currentStyle.openTypeFeatures = fTypeface.OT_FEATURE_FINAL_GLYPH_ON_LINE_ALTERNATES;