Skip to content

Commit

Permalink
Query for Fonts in the submitter now
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahuge committed Jun 26, 2024
1 parent 758cad6 commit 9ba9d8d
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/deadline/ae_submitter/data/InitData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,69 @@ function __generateInitData()
}
}
}
var fontReferences = generateFontReferences();
logger.debug("Get Fonts: " + key, scriptFileInitDataName);
for (var i = 0; i < fontReferences.length; i++) {
detectedItemsList.push(fontReferences[i]);
}
dcProperties.jobAttachments.autoDetectedInputFiles.set(detectedItemsList);
}

function _generateFontReferences() {
var fontLocations = [];
var usedList = app.project.usedFonts;
for (var i = 0; i < usedList.length; i++) {
var font = usedList[i].font;
var fontFamilyName = font.familyName;
var familyStyle = font.styleName;
var fontName = fontFamilyName + " " + familyStyle + ".otf";
fontLocations.push([fontName, fontLocation]);
}
return fontLocations
}

function _oldGenerateFontReferences() {
var fontLocations = [];
var items = app.project.items;
for (var i = items.length; i >= 1; i--) {
var myItem = app.project.item(i);
if (myItem instanceof CompItem) {
for (var j = myItem.layers.length; j >= 1; j--) {
var myLayer = myItem.layers[j];
if (myLayer instanceof TextLayer){
var textDocument = myLayer.text.sourceText.value;
var fontLocation = textDocument.fontLocation;
var fontFamilyName = textDocument.fontFamily;
var familyStyle = textDocument.fontStyle;
var fontName = fontFamilyName + " " + familyStyle + ".otf";
fontLocations.push([fontName, fontLocation]);
}
}
}
}
return fontLocations
}

function generateFontReferences() {
var rawFontPaths = [];
if (parseInt(app.version[0] + app.version[1]) >= 24) {
rawFontPaths = _generateFontReferences();
} else {
rawFontPaths = _oldGenerateFontReferences();
}
var _tempFilePath = dcUtil.normPath(Folder.temp.fsName + "/" + "tempFonts");
var formattedFontPaths = [];
for (var i = 0; i < rawFontPaths.length; i++) {
var fontName = rawFontPaths[0][0];
var fontLocation = rawFontPaths[0][1];
var fontFile = File(fontLocation);
var _filePath = dcUtil.normPath(_tempFilePath + "/" + fontName);
fontFile.copy(_filePath);
formattedFontPaths.push(_filePath);
}
return formattedFontPaths;
}

function initAutoDetectOutputDirectories()
{
var detectedOutputDirectories= [];
Expand Down

0 comments on commit 9ba9d8d

Please sign in to comment.