You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to change the line spacing on some API generated text. There doesn't seem to be a way to do it with current JS API, but is there a way to add it using the old API?
var text = group.newText({alignment: NSTextAlignmentCenter, text:copy, fixedWidth: true, font: NSFont.fontWithName_size_("Gotham HTF Book", 68.5)})
After looking at the code for the Sketch Set Line Height plugin, I tried using text.lineHeight() and text.setLineHeight() to no success. They come back saying those functions do not exist.
Any ideas? If there's a way to do it we can see about adding it to the JS API
The text was updated successfully, but these errors were encountered:
if you want to use old API calls on a new API object, you need to use sketchObject e.g.
var sketch = context.api();
var document = sketch.selectedDocument
var page = document.selectedPage
var layer = page.newText({alignment: NSTextAlignmentCenter, systemFontSize: 36, text:"Hello World"})
layer.sketchObject.setLineHeight(50)
http://www.sketchplugins.com is the official forum for plugin dev questions, although I guess this issue is also a request to add something to the new API (but there is a lot missing :p)
I'm trying to change the line spacing on some API generated text. There doesn't seem to be a way to do it with current JS API, but is there a way to add it using the old API?
var text = group.newText({alignment: NSTextAlignmentCenter, text:copy, fixedWidth: true, font: NSFont.fontWithName_size_("Gotham HTF Book", 68.5)})
After looking at the code for the Sketch Set Line Height plugin, I tried using
text.lineHeight()
andtext.setLineHeight()
to no success. They come back saying those functions do not exist.Any ideas? If there's a way to do it we can see about adding it to the JS API
The text was updated successfully, but these errors were encountered: