Skip to content

Commit

Permalink
Create Set Font Size.sketchplugin
Browse files Browse the repository at this point in the history
  • Loading branch information
bomberstudios committed Jul 28, 2014
1 parent 0274ebc commit ce22087
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Set Font Size.sketchplugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Change Selected Layers' Font Size (cmd shift t)
// This plugin will change the font size of all the text layers in the selection.
// If the selection is mixed (i.e: shapes and text layers) only text layers will be
// affected, and the selection will be modified when running the command, so only
// text layers will remain selected after running it.

var textLayers = []

for (var i=0; i < [selection count]; i++) {
var layer = [selection objectAtIndex:i]
if ([layer isKindOfClass:[MSTextLayer class]]) {
textLayers.push(layer)
}
}

if (textLayers.length == 0) {
[doc showMessage:"You need to select at least one text layer"]
} else {
var size = [doc askForUserInput:"Font Size for selected layers?" initialValue:16]
for (var i=0; i < textLayers.length; i++) {
var textLayer = textLayers[i]
[textLayer setFontSize:size]
}
[[doc currentPage] deselectAllLayers]
for(var i=0; i < textLayers.length; i++){
var layer = textLayers[i]
[layer select:true byExpandingSelection:true]
}
}

0 comments on commit ce22087

Please sign in to comment.