@@ -20,24 +20,46 @@ Most of these APIs simply return information which is contained in the Font data
2020#### Description
2121
2222Returns an Array of Objects, containing the design axes data from the font.
23- Each object is composed of the axis ` name ` , ` tag ` , ` min ` value and ` max ` value.
23+ Each object is composed of the axis ` name ` , ` tag ` , ` min ` value, ` max ` value, and ` default ` value.
2424
2525!!! tip
2626 Will return undefined for non-variable fonts.
2727
2828#### Example
2929
30- This example will select the first returned Font Family Array.
30+ This example demonstrates how to see the axes of a variable font on a selected Text layer:
3131
3232``` javascript
33- // Getting the first available Variable Font on the system
34- var firstVariableFont = fontsWithDefaultDesignAxes[0 ];
35- var axesData = firstVariableFont .designAxesData ;
36-
37- // Getting the first design axis for that Font
38- var firstAxis = axesData[0 ];
39-
40- alert (firstAxis .name + " \n " + firstAxis .tag + " \n " + firstAxis .min + " \n " + firstAxis .max );
33+ // Prerequisite: Create and select a Text layer that uses a variable font
34+ var textLayer = app .project .activeItem .selectedLayers [0 ];
35+
36+ // Get the font object
37+ var textDocument = textLayer .property (" Source Text" ).value ;
38+ var fontObject = textDocument .fontObject ;
39+
40+ // Check for axes and display any that are found
41+ if (fontObject && fontObject .designAxesData ) {
42+ var axes = fontObject .designAxesData ;
43+ var message = " Variable Font Axes (" + axes .length + " total):\n\n " ;
44+
45+ for (var i = 0 ; i < axes .length ; i++ ) {
46+ var axis = axes[i];
47+ message += " Axis " + (i + 1 ) + " :\n " ;
48+ message += " Tag: " + axis .tag + " \n " ;
49+ message += " Name: " + axis .name + " \n " ;
50+ message += " Min: " + axis .min + " \n " ;
51+ message += " Max: " + axis .max + " \n " ;
52+ message += " Default: " + axis .default + " \n " ;
53+
54+ if (i < axes .length - 1 ) {
55+ message += " \n " ;
56+ }
57+ }
58+
59+ alert (message);
60+ } else {
61+ alert (" No variable font axes found" );
62+ }
4163```
4264
4365#### Type
0 commit comments