Testing to see if I can build an Opentype Panel
✓ Published0🌍 Public
KKevinGutowski
Last edited Dec 19, 2018
Created on Dec 18, 2018
This example demonstrates how to programmatically enable OpenType font features—small caps for lowercase and uppercase letters, and old-style (lowercase) numerals—on a selected text layer in Sketch. It uses the Sketch JavaScript API via `require("sketch")` to access the selected document and text layer, then constructs a new font descriptor with `NSFontFeatureSettingsAttribute` and feature selectors like `kLowerCaseSmallCapsSelector`. The code applies the modified font at size 20 with `NSFont.fontWithDescriptor_size` and refreshes the inspector via `document.sketchObject.inspectorController().reload()`. The script relies on the `CoreText` framework and `FontSpike.js` as its execution environment.
AI-generated description