Created
June 13, 2020 07:05
-
-
Save KevinGutowski/34e1f5bd840d4c6105d0f46618022f5b to your computer and use it in GitHub Desktop.
NSAttributedString attributes
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
let sketch = require('sketch') | |
let doc = sketch.getSelectedDocument() | |
let selection = doc.selectedLayers.layers[0] | |
let menu = NSApplication.sharedApplication().mainMenu() | |
let pluginsMenu = menu.itemWithTitle('Plugins').submenu() | |
console.log(pluginsMenu.itemArray()[0].title()) | |
/* | |
let path = "/Users/Kski/Downloads/file.rtf" | |
let rtfData = NSData.dataWithContentsOfFile(path) | |
let atString = NSAttributedString.alloc().initWithRTF_documentAttributes(rtfData,null) | |
//selection.sketchObject.addAttribute_value_forRange(NSBaselineOffsetAttributeName, 10, NSMakeRange(3,1)) | |
//selection.sketchObject.addAttribute_value_forRange(NSSuperscriptAttributeName,1,NSMakeRange(10,1)) | |
// NOPE | |
//selection.sketchObject.addAttribute_value_forRange(NSBackgroundColorAttributeName,NSColor.yellowColor(),NSMakeRange(4,3)) | |
// NOPE | |
//selection.sketchObject.addAttribute_value_forRange(NSShadowAttributeName,NSShadow.alloc().init(),NSMakeRange(4,3)) | |
//selection.sketchObject.addAttribute_value_forRange(NSUnderlineStyleAttributeName,NSUnderlineStyleByWord,NSMakeRange(4,7)) | |
//selection.sketchObject.addAttribute_value_forRange(NSStrokeWidthAttributeName,4,NSMakeRange(4,7)) | |
selection.sketchObject.addAttribute_value(NSWritingDirectionAttributeName,[1]) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment