Free Function Friday collectFontsUsed

FFF Header

Welcome to to this weeks Free Function Friday episode. As we dive deeper into different parts of ExtendScript for After Effects, you will begin to find various limitations that you might not have thought about beforehand. A lot of things sound like they would be obvious or straight forward, but that isn’t always the case when dealing with ExtendScript. This week we learn how to retrieve the fonts used in a project file, which is a very useful bit of data for anyone tracking fonts between projects or for hand off to another artist. We will also run into one of those unknown ExtendScript limitations that will be very aggrivating. So prepare yourself to be a bit annoyed.

A lot of Technical Directors, artists, and developers have had a need to access fonts at one point or another in their project file, whether it was to list out what fonts were used, trying to change various properties of the fonts, or just verifying that the correct font was properly implemented in the project file. A lot of text layer data is accessible though ExtendScript, but not all of it unfortunately. One of the greatest issues right now, is that text layer source attributes that are accessible currently are only based on the first character of the text. In reality, we have control over changing the font, size, color, kerning, styles, and so much more within a single line of text as a user, which makes getting all that data virtually impossible with the current setup of ExtendScript. ExtendScript is making the assumption that the first character represents the settings of every single character of the text layer, which isn’t always true. Personally I feel that the ball was dropped majorly here, but like many things in life there are variables and politics at play that we are unaware of behind-the-scenes that can effect the course of something. Be that as it may, it is that much more important that we as After Effects users file a feature request to correct things like this. That is the only way for issues to be corrected really. The big down side to this, is that we will never see this fix for any After Effects versions prior to the day it finally gets implemented. Whenever that will be, so help out and make the request by filling out the feature request form here: Adobe After Effects Feature Request / Bug Report. it may sound trivial, but it is important to a lot of developers to have the freedom to access as much of an application as possible in order to design the powerful tools that help you get the job done.

I’ll even do the heavy lifting for you. Below is a bit of text in italics for you to copy and paste into the feature request form.

Title of your feature request:

ExtendScript per character access

Description of your feature request:

How would you like the feature to work?

I would like to be able to have read and write access to all attributes like font, size, color, kerning, style, etc… within a text layer’s source document object for each and EVERY single character. Accessing it by looping through each character would be helpful, or an object containing a collection of the data.

Why is this feature important to you?

Currently the restriction of getting the source values from only the first character is an inaccurate representation of the whole text layer’s source text. This prevents a developer from retrieving accurate font data that a project may hold. When handing off a project to another company or individual, knowing all of the required media involved, especially fonts, is vital. It also prevents any possibilities of building and/or replicating a custom text layer build that may involve mixed text attribute combinations.

Of course feel free to place your own words into the request field too, and thanks for helping improve ExtendScript.

If you haven’t done so already there is a Free Function Friday introduction video located here that has some important information pointing to a few resources that will come in handy when scripting for After Effects.

Episode 10 collectFontsUsed:

 

Legal note: The Adobe ExtendScript code talked about in this article and accompanying embedded video(s), and/or graphic images are not guaranteed to be compatible with every version of After Effects. David Torno, ProVideo Coalition, and Diversified will not be held liable for any misuse or incorrect use of the provided ExtendScript code. Use at your own risk.

All of the code I provide in this series, has been created and tested in After Effects CC 2014. Unless otherwise specified in the episode, the code should be compatible with After Effects CS6 through CC 2015. I’ve done my best to avoid depreciated code (code that Adobe removed at some point), and made these functions as compatible as possible. There will however be the occasional piece of code that is brand new as of a certain version of After Effects and therefore will not be backwards compatible from that version. I will mention these if that is the case.

With that said, all the code I provide in this series is open source and free to use in your scripts. I highly encourage you to expand and improve upon the code I provide and start making your own custom functions as well, but please do not repost the code I show in this series as is and claim it as your own. If you use any of the code provided in this series please give credit where credit is due. This series is meant to provide, what I feel is useful code, as well as to hopefully further explain ExtendScript and it’s quirks. While the functions we build throughout this series can perform a task all on their own, they are not meant to be a solo script. How you combine them together and expand upon them is when you will gain the most from these functions.


Share:

David Torno

David Torno is a Visual Effects professional based in Los Angeles, California. His work over the years has included commercials, feature films, music videos, and multimedia projects. During his free time, David enjoys expanding his knowledge in Visual Effects by learning new softwares and techniques that are being used. Along the way he also contributes to the visual effects community by offering helpful tools, and tutorials that creative professionals around the world can benefit from.