New Scripting Hooks for Variable Fonts
Copy link to clipboard
Copied
Hi everyone,
We're happy to announce that starting in Beta build 24.0x25, we have added 7 new scripting hooks related to variable fonts.
You can see the full list here and their respective documentation:
- https://ae-scripting.docsforadobe.dev/introduction/changelog.html.
- Please remember that these scripting hooks are currently in Beta and are subject to change.
We've also created a demo script panel that exercises these new hooks to inspect installed variable font axes and apply animation controls to create dynamic variable font animations:
The script is also attached to this post, but you must rename the file's extension from .jsx.txt to .jsx to run it inside AE.
We're excited to see what you'll be able to do with these new variable fonts hooks and to hear any feedback you may have!
Copy link to clipboard
Copied
Standard AE text animator integration? Is that coming or will this be tied to a script panel?
Copy link to clipboard
Copied
This announcement is only about revealing scripting hooks which build upon the recently released Font and Fonts scripting objects to work with Variable fonts through the TextDocument scripting object.
The target audience is 3rd party developers.
Fonts (and most other text attributes) remain not animateable through the standard AE text animator.
Douglas Waterfall
After Effects Engineering
Copy link to clipboard
Copied
app.project.usedFonts doesn't always pull all the used fonts in the project incase we made any changes in the project. It only works on first time. If we change add new font to text layers. We have to reopen the project to make it work. Please fix that,
Copy link to clipboard
Copied
I have not seen that behavior - and it does not cache any information - for every call it iterates all the layers and discovers what is used now.
We have had a report that if one is in the middle of editing a Layer that the change will not be recognized until the layer is committed (click out of the text box). In effect the call is seeing the original unchanged Text Layer, not the one that is in the middle of being changed.
Could that explain the behavior you are seeing?
Douglas Waterfall
After Effects Engineering
Copy link to clipboard
Copied
Sorry that's not what I'm talking about. The issue happens with duplicating text layer and changing it to new font. If we duplicate a text layer and change the font of either of the layers it won't detect the old font used in the original layer. Even if we remove the layer which have the new font. It always shows us the removed font. Not the font that remain in the project.
Copy link to clipboard
Copied
One more issue. If we apply font to the text layer with expression style.setFont("One")
app.project.usedFonts recognize "One"
But when we try to change the font by
app.project.replaceFont([One Font Object], [Two Font Object])
it doesn't change the expression style.setFont("Two") Fix that too if it possible.
Copy link to clipboard
Copied
Expressions do not work the same way as Scripting with respect to fonts. app.usedFonts does its work by visiting all the layers and asks them what fonts have been applied - it cannot look into the Expression to see what fonts might be applied.
This is a long standing difference due to Expressions being calculated on the fly during rendering and the fonts which are used by the Expression are not referenced on the Text Layer at all.
In a related way, fonts used via Expressions do not sync from Adobe Fonts on open - because they are not referenced in the Text Layer. This is the reason why folks create hidden Text Layers which DO reference the fonts used in their Expressions so on open they will get the automatically sync from Adobe Fonts.
I can understand why you want/need this but we have no obvious way to supply this information. One would have to render the whole project and watch what fonts were used along the way, which might not be a reliable list and change due to an Expression changing. It is an interesting problem. Hmm.
Douglas Waterfall
After Effects Engineering
Copy link to clipboard
Copied
This is awesome! One question: I'm trying to set a bunch of layers with this script applied be set to the same word, but since the script generates an expression in the source text field using the normal "thisComp.layer("MASTER TEXT").text.sourceText;" doesn't find a home anywhere in the expression, if I add it to the end, it changes the text but doesn't apply the expression. Am I missing something?
Copy link to clipboard
Copied
Hi @Gucci Robot,
If I understand your question correctly, you'll want to modify the expression written by the script by adding a reference to your "MASTER TEXT" layer and then calling the "setText()" method to change the text of the variable font layer. Here's an example of what that might look like within the expression written by the script: 
Circled in green, I've made a reference to the "MAIN TEXT" layer.
Circled in yellow, I've added ".setText(...)" with a reference to the "MAIN TEXT" layer's Source Text property.
More info on setText() can be found here: https://ae-expressions.docsforadobe.dev/text-style.html#textstyle-settext-value
Let me know if this isn't quite what you are going for or if you have additional questions.
Cheers,
- John, After Effects Engineering Team
Copy link to clipboard
Copied
Thank you so much! We arrived at the same conclusion 🙂 I am starting my scripting journey here and I really appreciate the help
Copy link to clipboard
Copied
HI, I have a problem. I want to use "app.project.usedFonts" in my script, but everytime I get alert with: "undefined".
Copy link to clipboard
Copied
Not running the Beta version perhaps? That would seem the most likely explanation.
Douglas Waterfall
After Effects Engineering
Copy link to clipboard
Copied
Thanks for reply.
I am not sure. I am running version of AE 24.0.1 (Build 2)
Copy link to clipboard
Copied
That is not the beta version - it would be 24.1
Douglas Waterfall
After Effects Engineering
Copy link to clipboard
Copied
I don't see any option to enable per character variable font animation...is there a way to write that into this script? Or link it to an offset slider? I see in the animations for this, like with the wavy effects it must be possible?
Copy link to clipboard
Copied
Hi @Sean JS.,
Currently, per-character variable font animation is not supported on a single Text layer, since the variable axes are not piped through to the Text Animator system and expressions can only set a single typeface per layer. In creating the wavy animation in the GIF above, all the animation was done on a single Text layer and then pre-comped and offset using traditional animation techniques.
We are definitely aware of how important per-character animation is in After Effects. Any new functionality in this area will come first to Beta builds, so keep an eye on those.
Cheers,
- John, After Effects Engineering Team
Copy link to clipboard
Copied
I have updated the origial script to support offset values like a text animator. This new version only works with AE25 and higher.
remove the .txt and put the file in After Effects/Scripts/ScriptUI Panels
Example
Settings
Copy link to clipboard
Copied
Hi Greg, I tried your script but I get the following error
"Function supportedAxes.indexOf is undefined"
Copy link to clipboard
Copied
That font seems to have alot of Axes that i may not have tested for. It looks like one of the apple SF fonts but I cant find it. Can you tell me where i can?
Copy link to clipboard
Copied
Hi Greg, it's an internal font based on SF. I tried with other system fonts (Skia and Noto Sans) with one or two axes and I get the same error.
Copy link to clipboard
Copied
I dont get an error with my Noto Sans but it also dont see anyhting when i change the weight. The original script also does not make any changes to this font.
Have you tried the original:
Copy link to clipboard
Copied
I've been trying to use the demo script to make some animations with variable fonts but the expression overhead is pretty intense at 300-500ms! Will native variable font support ever come to AE?
Copy link to clipboard
Copied
Getting bad BIB errors when trying to render something with variable font controls enabled.
It ram previews fine but can't export.
Copy link to clipboard
Copied
Workaround for now seems to be using "current settings" in the render queue.


-
- 1
- 2