Scripting: New and updated APIs for Font Management
Hi everyone,
Starting with AE 24.4.0.24 beta, we have introduced a number of miscellaneous Font management APIs which we hope will be super interesting to some of you who have more refined workflows around Fonts - we created them to help our internal testing, and decided to expose them to Beta following your feedback.
As always, we have updated the Scripting Documentation, where you will find more detailed information about these new APIs. Here is a quick overview of the new APIs:
app.fonts.fontsDuplicateByPostScriptName
Having more than one Font instance which has the same PostScript name can lead to surprises when the Font instance you thought you were going to get was not the one the FontServer handed back. Earlier releases of After Effects were prone to crash in this state and one of the focuses of the last year of FontServer work was to make this situation work.
Simply use the TextDocument.font API to select a Font by PostScript name is problematic when there is more than one Font instance with the same PostScript name - did the FontServer select the one you wanted?
app.fonts.mruFontFamilyList
app.fonts.favoriteFontFamilyList
Access to Most Recently Used (MRU), and Favorites font lists anywhere you can choose fonts from these lists. Ever wanted to clear these lists? Just pass in an empty array.
Want to define your own Favorites programmatically rather than clicking in the UI? Here is the way.
app.fonts.freezeSyncSubstitutedFonts
By default when After Effects opens a Project, and it finds that it has a Font reference which does not exactly match an installed Font, it will attempt to activate an Adobe Font with the same PostScript name if it can find one there. Not all workflows want this to happen - a popular reason being server workflows where they never want to use Adobe Fonts and so the automatic install just makes the Font environment more complicated for them. This API will disable the automatic activation from Adobe Fonts.
app.fonts.substitutedFontReplacementMatchPolicy
When After Effects has a missing Font reference when opening a Project, which appears in the UI as a bracket font name at the bottom of the Character Panels, it will automatically look in the Font environment to find a candidate Font to replace it with.
Consider the case where a Project file was saved using Courier on Windows, and then opened on the Mac. If the two installed Font instances do not share the same Font properties that After Effects requires, it will be treated as a missing Font reference when opened on the Mac.
It is longstanding behavior in After Effects to silently allow this sort of quiet substitution, and so by default when evaluating a missing Font reference we only require that we find another Font instance that has the same PostScript name to replace it.
All this happens automatically but do be aware that the Project IS changed by the replacement of the original referenced Font with the replacement Font. If this Project was saved and brought back to Windows the same thing would happen again in reverse.
Some workflows do not want this loose behavior at all - a close substitute, merely by PostScript name, is not acceptable to them. It is better to realize the Font is missing and go find it than have the composition change in a silent and potentially undesired way.
Other workflows do not want any replacement at all - a popular assumption being that all the Fonts should have been already installed so why is anything missing at all?
This API provides these two additional policies over the default PostScript-name-only one.
app.fonts.pollForAndPushNonSystemFontFoldersChanges
Finally, erver-based workflows which need to add and remove their own Font instances through scripting without resorting to using the OS tools, have a challenge in getting After Effects to notice that the Font environment has changed through their actions.
Fonts that are changed through the OS tools, and by Adobe Fonts activation, are automatically detected but Fonts that are changed in the Application Support Fonts folder (and the equivalent on Windows) are not detected until After Effects restarts or the Font environment changes in folders which are automatically detected. This experimental API allows the scripter to give the Font environment a little push to recognize if the Font environment has changed outside of the System Font folders, and it has it will schedule an update to the Font environment to process it.
It has been requested that we expose the ability to dynamically add additional Font search folders - it is something we are considering.
As always we are interested in hearing about the successful use of these APIs and feedback on how they might be made better for your workflow.
Douglas Waterfall, John Colombo & Sébastien Périer
After Effects Engineering

