Skip to main content
100%

Attempting to set font attributes during selection

✓ Published0🌍 Public
KKevinGutowski
Last edited Jan 27, 2019
Created on Jan 27, 2019

This example demonstrates how to modify font attributes of selected text within a Sketch document. It uses the Sketch JavaScript API and the CoreText framework to apply small-caps styling to the first five characters of a text layer. The script accesses the document's selected text layer, checks if it is in editing mode, then retrieves the text storage and font descriptor to construct a modified font with the small-caps feature enabled. It applies the new font attribute to the specified range and finalizes the changes with the text storage editing methods.

AI-generated description

Similar vizzes