Skip to content

Instantly share code, notes, and snippets.

@robkovacs
Last active June 23, 2016 20:53
Show Gist options
  • Select an option

  • Save robkovacs/aff0aa78ea5c95281ff458137e709cd9 to your computer and use it in GitHub Desktop.

Select an option

Save robkovacs/aff0aa78ea5c95281ff458137e709cd9 to your computer and use it in GitHub Desktop.
A quick and dirty way to redraw all your text layers in Sketch - useful if you switch between versions of a font (Typekit to non-Typekit, for example).
function check_layer(layer) {
switch ([layer class]) {
case MSTextLayer:
var fs = [layer fontSize] + 1;
layer.setFontSize(fs).setFontSize(fs - 1);
break;
}
}
var doc = context.document;
// loop through layers on current page
var page = [doc currentPage];
var layers = [page children];
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