-
-
Save janily/60247290de0f6b10cf40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* PhotoShop script to list used fonts | |
* @author Dave Stewart | |
* @date 23 May 2013 | |
* @url twitter.com/dave_stewart | |
*/ | |
function listFonts() | |
{ | |
// functions | |
function checkSet(set) | |
{ | |
for(var j = 0; j < set.layers.length; j++) | |
{ | |
var layer = set.layers[j]; | |
if(layer.kind == LayerKind.TEXT) | |
{ | |
var font = layer.textItem.font; | |
if(fonts[font] == null) | |
{ | |
fonts.push(font); | |
fonts[font] = true; // no indexOf() so set a flag | |
} | |
} | |
} | |
} | |
// variables | |
var sets = app.activeDocument.layerSets; | |
var fonts = []; | |
// check layers | |
checkSet(app.activeDocument); | |
// check sets | |
for(var i = 0; i < sets.length; i++) | |
{ | |
checkSet(sets[i]); | |
} | |
// result | |
var message = fonts.length | |
? 'The following fonts are being used:\n\n' + fonts.join('\n') | |
: 'No fonts used in document'; | |
$.writeln(message); | |
return '\n\n' + message; // check the ExtendScript Toolkit console to copy and paste the list of used fonts | |
} | |
listFonts(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment