Expressions/Scripts/Presets

Moderator: byronnash

 
Varangian
Topic Author
Posts: 38
Joined: Thu Dec 16, 2004 11:15 am

Collect fonts

Fri Apr 20, 2007 8:44 pm

This would be a VERY handy script:
A script that would collect all the fonts used in an AE project and copy them to a destination. Much like Collect files does for the linked files in an AE project.

I realize this is probaby not easy, and would be totally different for Mac and Windows, but WOW how handy!
 
Mylenium
Posts: 139
Joined: Wed Jul 20, 2005 12:07 am

Re: Collect fonts

Sat Apr 21, 2007 10:01 am

Varangian wrote:
This would be a VERY handy script:
A script that would collect all the fonts used in an AE project and copy them to a destination. Much like Collect files does for the linked files in an AE project.

I realize this is probaby not easy, and would be totally different for Mac and Windows, but WOW how handy!


Not easy? Impossible at this point. No way to access those properties with scripts or expressions.

Mylenium
[Pour Mylène, ange sur terre]
 
stweed
Posts: 9
Joined: Thu Feb 18, 2016 2:35 pm

Re: Collect fonts

Sun Nov 26, 2017 7:51 pm

Mylenium wrote:
Varangian wrote:
This would be a VERY handy script:
A script that would collect all the fonts used in an AE project and copy them to a destination. Much like Collect files does for the linked files in an AE project.

I realize this is probaby not easy, and would be totally different for Mac and Windows, but WOW how handy!


Not easy? Impossible at this point. No way to access those properties with scripts or expressions.

Mylenium

Impossible? Never :) Not even close! See "text document object" in the AE scripting guide. Here's a function which will at least get you so far as telling you what fonts are used in the file. You'll have to handle the file copies yourself, personally I use the "os" module in python external to After Effects. (This function is part of a MUCH larger program I am in development on which handles archives for a number of applications including AE and Nuke.)
Lemme know if you have questions, I'd be happy to help!
function FontSniff() {
 var fonts = [];

 var allItems = app.project.items;
 // for each item in the project
 for (i=1; i <= allItems.length; i++) {
     var curItem = allItems[i];
     // check if this item is a composition
     if (curItem instanceof CompItem) {
         var allLayers = curItem.layers;
         // for every layer in the composition
         for (j=1; j <= allLayers.length; j++) {
             var curLayer = allLayers[j];
             // check if it is a text layer
             if (curLayer instanceof TextLayer) {
             // ok now just grab the font name and put it in the fonts array!
             var textProp = curLayer.property("Source Text");
             var textDocument = textProp.value;
             fonts.push(textDocument.font);
             }
         }
     }
 }

 if (fonts.length < 1) {
 return false;
 } else {
 // we's got'z fontz!
 return fonts;
 }
}

alert(FontSniff());
 
stweed
Posts: 9
Joined: Thu Feb 18, 2016 2:35 pm

Re: Collect fonts

Sun Nov 26, 2017 7:52 pm

Wow I just realized I answered this guy's question 10 years too late... for all I know he's dead by now... how sad.

Who is online

Users browsing this forum: No registered users and 1 guest