Attempting to Highlight First Letter
✓ Published0🌍 Public
KKevinGutowski
Last edited Jun 13, 2020
Created on Jun 13, 2020
This Sketch plugin example demonstrates how to highlight the first letter of a selected text layer. The script calculates the bounding box of the first glyph using Sketch’s text layout APIs, including `NSTextContainer`, `NSLayoutManager`, and `boundingRectForGlyphRange`, then draws a red rectangle behind that letter. The gist creates a reusable highlight shape and removes any previous version, making it easy to re-run the code. The plugin relies on the Sketch.js library to access and manipulate the document’s layers and shapes.
AI-generated description