Created
June 17, 2015 04:42
-
-
Save glesage/9d5d94add51a363cf539 to your computer and use it in GitHub Desktop.
Change all fonts except Gizmo to Proxima Nova
This file contains hidden or 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
var doc = context.document; | |
var page = [doc currentPage]; | |
var layers = [page children]; | |
var font_name = "Proxima Nova"; | |
function check_layer(layer) | |
{ | |
if (!layer) return; | |
switch ([layer class]) | |
{ | |
case MSTextLayer: | |
if ([layer fontPostscriptName] == "SSGizmo") log("Gizmo"); | |
else layer.setFontPostscriptName(font_name); | |
break; | |
case MSPage: | |
case MSLayerGroup: | |
case MSArtboardGroup: | |
var sublayers = [layer layers]; | |
break; | |
log("This is a group/artboard/page with " + [sublayers count] + " sublayers") | |
for(var i=0; i < [sublayers count]; i++) | |
{ | |
var sublayer = sublayers[i]; | |
check_layer(sublayer); | |
} | |
break; | |
} | |
} | |
for (var i = 0; i < [layers count]; i++) | |
{ | |
check_layer(layers[i]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment