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:
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'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.
Copy link to clipboard
Copied
@scrozier Thank you for reporting this.
As it happens I hit the same problem here a bit before you and have been looking into it.
Given my current understanding of the vulnerability, it is not a new problem and perhaps the intense variable font text animation via Expressions just increases the odds of it happening.
Any workaround you might come up with is likely to just be luck imho.
It is not looking like it has a trivial solution. When we know more we feel we can pass on, we will.
Douglas Waterfall
After Effects Engineering
Copy link to clipboard
Copied
@Douglas_Waterfall Yeah it plays back with no issues in Ram Preview but once I go to the render queue that is when things to awry. Using "current settings" I think makes AE us the ram buffer to export instead of whatever bug it's hitting in the Render Queue. That has been my expereince so far. Once I try to render the comp with "best settings" variable fonts don't work again until I repopen the project.
Copy link to clipboard
Copied
You may be right about luck because sometimes it renders without issue but once the bug arises you have to revert the project file because it becomes a bit unstable. I tried a test with MFR on/off with
"best settings" on a hunch and both times it rendered fine.
Copy link to clipboard
Copied
MT rendering off may improve the odds, but that is only guess. The odds are still not good.
Douglas Waterfall
After Effects Engineering
Copy link to clipboard
Copied
@Douglas_Waterfall Another thing that doesn't seem to work is per character kerning or baseline offset when variable fonts are enabled via the supplied script