Change font size programmatically
✓ Published0🌍 Public
KKevinGutowski
Last edited Dec 18, 2018
Created on Dec 18, 2018
This example demonstrates how to programmatically change the font size of a selected text layer within a Sketch document. It shows the direct manipulation of a text layer’s typographic properties through the Sketch JavaScript API. The code uses the `sketch` library to access the document, retrieves the first selected layer, and applies a new font size using `NSFont.fontWithDescriptor_size` with a value of 12. After modifying the layer’s `_object`, it calls the inspector controller’s `reload()` method to refresh the UI and reflect the change.
AI-generated description