SketchAPI
SketchAPI copied to clipboard
Setting the lineHeight of a layer to null repositions the text location.
There is some funny behavior going on that is different from the behavior of the inspector.
Steps to reproduce:
-
You will want to choose a font that has a wildly different text position within the text frame when there is no line height set vs when there is. One such font is Adobe Garamond Pro.
-
See how setting a line height (the default line height) changes the frame of the text layer however the text location remains constant relative to the canvas/page.
-
Now attempt to set the line height programmatically. You’ll notice that the frame no longer changes but rather the text location.
Honestly, I’m not sure what the best resolution for this is. I just thought I would mention the differences between programmatically setting the line height vs setting the line height via the inspector.