Collect fonts
Moderator: byronnash
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.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!
Mylenium
Impossible? NeverMylenium wrote:Not easy? Impossible at this point. No way to access those properties with scripts or expressions.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!
Mylenium

Lemme know if you have questions, I'd be happy to help!
Code: Select all
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());
-
- Posts: 1
- Joined: June 5th, 2021, 2:14 am
well i want to get the names of all the font styles used in the aep file so using node js im doing something like this but i cant get the spaces between the fonts. how do i get the fonts with spaces and all. here is my current code
function fileChosen(path){
effectsUsed = [];
fs.readFile(path, (err, data) => {
if (err) throw err;
file = data.toString();
getFontsUsed(file);
});
}
function getFontsUsed(file){
fontsUsed = [];
externalFonts.innerHTML = "";
var fonts = file.split("CoolTypeFont");
for(let index = 1; index < fonts.length; index += 3){
var font = fonts[index];
var indexStart = font.indexOf("(");
var indexEnd = font.indexOf(")");
var name = font.substring(indexStart+1,indexEnd);
name = name.replace(/[^\w\s\.]/gi,'');
if(!fontsUsed.includes(name)){
fontsUsed.push(name);
}
}
the problem with this script is that i dont get the spaces in between the character where they are supposed to be
in the font name
Hope you wont take 10 years this time
thank you