fontobject
Font object
Section titled “Font object”Description
Section titled “Description”The Font object provides information about a specific font, along with the font technology used, helping disambiguate when multiple fonts sharing the same Postscript name are installed on the system.
Most of these APIs simply return information which is contained in the Font data file itself, seek more information there.
Attributes
Section titled “Attributes”FontObject.designAxesData
Section titled “FontObject.designAxesData”app.fonts.allFonts[0][0].designAxesData
Description
Section titled “Description”Returns an Array of Objects, containing the design axes data from the font.
Each object is composed of the axis name, tag, min value and max value.
Example
Section titled “Example”This example will select the first returned Font Family Array.
// Getting the first available Variable Font on the systemvar firstVariableFont = fontsWithDefaultDesignAxes[0];var axesData = firstVariableFont.designAxesData;
// Getting the first design axis for that Fontvar firstAxis = axesData[0];
alert(firstAxis.name+"\n"+firstAxis.tag+"\n"+firstAxis.min+"\n"+firstAxis.max);Array of Objects; read-only.
FontObject.designVector
Section titled “FontObject.designVector”app.fonts.fontsWithDefaultDesignAxes[0].designVector
Description
Section titled “Description”For Variable fonts will return an ordered array with a length matching the number of design axes defined by the font.
Array of floating-point values; read-only.
FontObject.familyName
Section titled “FontObject.familyName”app.fonts.allFonts[0][0].familyName
Description
Section titled “Description”The family name of the font, in the ASCII character set.
String; read-only.
FontObject.familyPrefix
Section titled “FontObject.familyPrefix”app.fonts.fontsWithDefaultDesignAxes[0].familyPrefix
Description
Section titled “Description”The family prefix of the variable font. For example, the family of the PostScript name “SFPro-Bold” is “SFPro”.
String; read-only.
FontObject.fontID
Section titled “FontObject.fontID”app.fonts.allFonts[0][0].fontID
Description
Section titled “Description”A unique number assigned to the FontObject instance when it is created, value is greater than or equal to 1. It never changes during the application session but may be different in subsequent launches of the application.
Can be used to compare two FontObject instances to see if they refer to the same underlying native font instance.
FontObjects can be looked up by fontID with getFontByID .
Integer; read-only.
FontObject.fullName
Section titled “FontObject.fullName”app.fonts.allFonts[0][0].fullName
Description
Section titled “Description”The full name of the font, in the ASCII character set. Usually composed of the family name and the style name.
String; read-only.
FontObject.hasDesignAxes
Section titled “FontObject.hasDesignAxes”app.fonts.allFonts[0][0].hasDesignAxes
Description
Section titled “Description”Returns true if the font is a variable font.
Boolean; read-only.
FontObject.isFromAdobeFonts
Section titled “FontObject.isFromAdobeFonts”app.fonts.allFonts[0][0].isFromAdobeFonts
Description
Section titled “Description”Returns true if the font is from Adobe Fonts.
Boolean; read-only.
FontObject.isSubstitute
Section titled “FontObject.isSubstitute”app.fonts.allFonts[0][0].isSubstitute
Description
Section titled “Description”returns true when this font instance represents a font reference which was missing on project open.
Boolean; read-only.
FontObject.location
Section titled “FontObject.location”app.fonts.allFonts[0][0].location
Description
Section titled “Description”The location of the font file on your system.
Not guaranteed to be returned for all font types; return value may be empty string for some kinds of fonts.
String; read-only.
FontObject.nativeFamilyName
Section titled “FontObject.nativeFamilyName”app.fonts.allFonts[0][0].nativeFamilyName
Description
Section titled “Description”The native family name of the font in full 16 bit Unicode. Often different than what is returned by FontObject.familyName for non-Latin fonts.
String; read-only.
FontObject.nativeFullName
Section titled “FontObject.nativeFullName”app.fonts.allFonts[0][0].nativeFullName
Description
Section titled “Description”The native full name of the font in full 16 bit Unicode. Often different than what is returned by FontObject.fullName for non-Latin fonts.
String; read-only.
FontObject.nativeStyleName
Section titled “FontObject.nativeStyleName”app.fonts.allFonts[0][0].nativeStyleName
Description
Section titled “Description”The native style name of the font in full 16 bit Unicode. Often different than what is returned by FontObject.styleName for non-Latin fonts.
String; read-only.
FontObject.postScriptName
Section titled “FontObject.postScriptName”app.fonts.allFonts[0][0].postScriptName
Description
Section titled “Description”The postscript name of the font.
String; read-only.
FontObject.styleName
Section titled “FontObject.styleName”app.fonts.allFonts[0][0].styleName
Description
Section titled “Description”The style name of the font, in the ASCII character set.
String; read-only.
FontObject.technology
Section titled “FontObject.technology”app.fonts.allFonts[0][0].technology
Description
Section titled “Description”The technology used by the font.
An CTFontTechnology enumerated value; read-only. One of:
CTFontTechnology.CT_TYPE1_FONTCTFontTechnology.CT_TRUETYPE_FONTCTFontTechnology.CT_CID_FONTCTFontTechnology.CT_BITMAP_FONTCTFontTechnology.CT_ATC_FONTCTFontTechnology.CT_TYPE3_FONTCTFontTechnology.CT_SVG_FONTCTFontTechnology.CT_ANYTECHNOLOGY
FontObject.type
Section titled “FontObject.type”app.fonts.allFonts[0][0].type
Description
Section titled “Description”The internal type of the font.
An CTFontType enumerated value; read-only. One of:
CTFontType.CT_TYPE1_FONTTYPECTFontType.CT_TRUETYPE_FONTTYPECTFontType.CT_CID_FONTTYPECTFontType.CT_ATC_FONTTYPECTFontType.CT_BITMAP_FONTTYPECTFontType.CT_OPENTYPE_CFF_FONTTYPECTFontType.CT_OPENTYPE_CID_FONTTYPECTFontType.CT_OPENTYPE_TT_FONTTYPECTFontType.CT_TYPE3_FONTTYPECTFontType.CT_SVG_FONTTYPE
FontObject.version
Section titled “FontObject.version”app.fonts.allFonts[0][0].version
Description
Section titled “Description”The version number of the font.
String; read-only.
FontObject.writingScripts
Section titled “FontObject.writingScripts”app.fonts.allFonts[0][0].writingScripts
Description
Section titled “Description”The supported character sets of the font.
An array of CTScript enumerated values; read-only. One or more of:
CTScript.CT_ROMAN_SCRIPTCTScript.CT_JAPANESE_SCRIPTCTScript.CT_TRADITIONALCHINESE_SCRIPTCTScript.CT_KOREAN_SCRIPTCTScript.CT_ARABIC_SCRIPTCTScript.CT_HEBREW_SCRIPTCTScript.CT_GREEK_SCRIPTCTScript.CT_CYRILLIC_SCRIPTCTScript.CT_RIGHTLEFT_SCRIPTCTScript.CT_DEVANAGARI_SCRIPTCTScript.CT_GURMUKHI_SCRIPTCTScript.CT_GUJARATI_SCRIPTCTScript.CT_ORIYA_SCRIPTCTScript.CT_BENGALI_SCRIPTCTScript.CT_TAMIL_SCRIPTCTScript.CT_TELUGU_SCRIPTCTScript.CT_KANNADA_SCRIPTCTScript.CT_MALAYALAM_SCRIPTCTScript.CT_SINHALESE_SCRIPTCTScript.CT_BURMESE_SCRIPTCTScript.CT_KHMER_SCRIPTCTScript.CT_THAI_SCRIPTCTScript.CT_LAOTIAN_SCRIPTCTScript.CT_GEORGIAN_SCRIPTCTScript.CT_ARMENIAN_SCRIPTCTScript.CT_SIMPLIFIEDCHINESE_SCRIPTCTScript.CT_TIBETAN_SCRIPTCTScript.CT_MONGOLIAN_SCRIPTCTScript.CT_GEEZ_SCRIPTCTScript.CT_EASTEUROPEANROMAN_SCRIPTCTScript.CT_VIETNAMESE_SCRIPTCTScript.CT_EXTENDEDARABIC_SCRIPTCTScript.CT_KLINGON_SCRIPTCTScript.CT_EMOJI_SCRIPTCTScript.CT_ROHINGYA_SCRIPTCTScript.CT_JAVANESE_SCRIPTCTScript.CT_SUNDANESE_SCRIPTCTScript.CT_LONTARA_SCRIPTCTScript.CT_SYRIAC_SCRIPTCTScript.CT_TAITHAM_SCRIPTCTScript.CT_BUGINESE_SCRIPTCTScript.CT_BALINESE_SCRIPTCTScript.CT_CHEROKEE_SCRIPTCTScript.CT_MANDAIC_SCRIPTCTScript.CT_VAI_SCRIPTCTScript.CT_THAANA_SCRIPTCTScript.CT_BRAVANESE_SCRIPTCTScript.CT_BRAHMI_SCRIPTCTScript.CT_CARIAN_SCRIPTCTScript.CT_CYPRIOT_SCRIPTCTScript.CT_EGYPTIAN_SCRIPTCTScript.CT_IMPERIALARAMAIC_SCRIPTCTScript.CT_PAHLAVI_SCRIPTCTScript.CT_PARTHIAN_SCRIPTCTScript.CT_KHAROSHTHI_SCRIPTCTScript.CT_LYCIAN_SCRIPTCTScript.CT_LYDIAN_SCRIPTCTScript.CT_PHOENICIAN_SCRIPTCTScript.CT_PERSIAN_SCRIPTCTScript.CT_SHAVIAN_SCRIPTCTScript.CT_SUMAKKCUNEIFORM_SCRIPTCTScript.CT_UGARITIC_SCRIPTCTScript.CT_GLAGOLITIC_SCRIPTCTScript.CT_GOTHIC_SCRIPTCTScript.CT_OGHAM_SCRIPTCTScript.CT_OLDITALIC_SCRIPTCTScript.CT_ORKHON_SCRIPTCTScript.CT_RUNIC_SCRIPTCTScript.CT_MEROITICCURSIVE_SCRIPTCTScript.CT_COPTIC_SCRIPTCTScript.CT_OLCHIKI_SCRIPTCTScript.CT_SORASOMPENG_SCRIPTCTScript.CT_OLDHANGUL_SCRIPTCTScript.CT_LISU_SCRIPTCTScript.CT_NKO_SCRIPTCTScript.CT_ADLAM_SCRIPTCTScript.CT_BAMUM_SCRIPTCTScript.CT_BASSAVAH_SCRIPTCTScript.CT_NEWA_SCRIPTCTScript.CT_NEWTAILU_SCRIPTCTScript.CT_SCRIPTCTScript.CT_OSAGE_SCRIPTCTScript.CT_UCAS_SCRIPTCTScript.CT_TIFINAGH_SCRIPTCTScript.CT_KAYAHLI_SCRIPTCTScript.CT_LAO_SCRIPTCTScript.CT_TAILE_SCRIPTCTScript.CT_TAIVIET_SCRIPTCTScript.CT_DONTKNOW_SCRIPT
Methods
Section titled “Methods”FontObject.hasGlyphsFor()
Section titled “FontObject.hasGlyphsFor()”app.fonts.allFonts[0][0].hasGlyphsFor(charString)
Description
Section titled “Description”Fonts do not contain glyphs for all possible ranges of Unicode and this method gives the caller the opportunity to query the Font about support for one or more characters.
Returns true if the font has a glyph for every character in the charString.
The character order does not matter, and in the case of a parameter string with more than one character, it is not possible though this API to determine which character had no glyph support.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
charString | String | Text that will be checked for support in the Font object. |
Returns
Section titled “Returns”Boolean.
FontObject.hasSameDict()
Section titled “FontObject.hasSameDict()”app.fonts.fontsWithDefaultDesignAxes[0].hasSameDict(fontObject)
Description
Section titled “Description”This function will true if the Font object passed as an argument shares the same variable font dictionary as the Font object the function is called on.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
fontObject | Font object | Object to check |
Returns
Section titled “Returns”Boolean.
FontObject.otherFontsWithSameDict()
Section titled “FontObject.otherFontsWithSameDict()”app.fonts.fontsWithDefaultDesignAxes[0].otherFontsWithSameDict(fontObject)
Description
Section titled “Description”Given an Font object passed as an argument, returns an Array of Font object instances which share the same font dictionary as the Font object the function is called on.
Will return an empty Array if the argument is not a Variable font, or the Variable font only has one instance (the parameter one).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
fontObject | Font object | Object to check |
Returns
Section titled “Returns”Array of Font objects, may be empty.
FontObject.postScriptNameForDesignVector()
Section titled “FontObject.postScriptNameForDesignVector()”app.fonts.fontsWithDefaultDesignAxes[0].postScriptNameForDesignVector([...vectorValues])
Description
Section titled “Description”This function will return the postscript name of the variable font for the specific design vectors passed as the argument.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
vectorValues | Array of floating-point values | Values to check FontObject.designVector for the given variable font. |
Returns
Section titled “Returns”A String.