Closed patrickhill closed 2 years ago
Hi, I think that's a Sketch bug
Doing some research. I found methods for setLineSpacing and setLineHeight for MSTextLayer. They can't both do the same thing so I'm hoping one of them controls paragraph spacing. Will test soon.
Getting close. The following works if I have a text layer selected on the canvas. However, if I create a text layer dynamically ([[MSTextLayer alloc] initWithFrame:nil];
), it doesn't have a paragraphStyle
as part of attributes
. So if we can just figure out how to add a paragraphStyle
to attributes
we should be set.
var layer = context.selection[0];
var paragraphStyle = layer.style().textStyle().attributes().NSParagraphStyle;
paragraphStyle.setParagraphSpacing(20);
you should be able to do layer.paragraphStyle().setParagraphSpacing(20)
directly
@mathieudutour Thanks. I'd expect this to log 99
, but it logs 0
:
var textLayer = [[MSTextLayer alloc] initWithFrame:nil];
textLayer.paragraphStyle().setParagraphSpacing(99);
log(textLayer.paragraphStyle().paragraphSpacing())
hum weird. Here is what I'm doing: https://github.com/mathieudutour/sketch-module-json-sync/blob/master/src/NS/spacing.js and it seems to work
Neither the spreadsheet template or the plugin currently support paragraph spacing.