feat: add fontFamily, letterSpacing and lineHeight to text tools - #139
Open
kuba-guzik wants to merge 1 commit into
Open
feat: add fontFamily, letterSpacing and lineHeight to text tools#139kuba-guzik wants to merge 1 commit into
kuba-guzik wants to merge 1 commit into
Conversation
Extends create_text and set_text_content with full typography control: - fontFamily: custom font support with Inter fallback - letterSpacing: precise tracking in pixels - lineHeight: explicit line height in pixels All params are optional and backward-compatible. Addresses grab#138. Co-authored-by: Cursor <cursoragent@cursor.com>
kuba-guzik
force-pushed
the
feat/font-family-support
branch
from
February 16, 2026 15:47
a60f526 to
175c119
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
fontFamilyparameter to thecreate_textandset_text_contenttools, allowing users to specify custom font families when creating or modifying text nodes in Figma.Changes
create_text(server.ts + code.js): Added optionalfontFamilyparameter (defaults to"Inter"). The Figma plugin attempts to load the requested font family and falls back to Inter if it's not available.set_text_content(server.ts + code.js): Added optionalfontFamilyandfontWeightparameters for changing the font of existing text nodes. If not provided, the existing font is preserved.FigmaCommandtype to include the new optional fields.Motivation
Currently, all text created via
create_textuses hardcoded"Inter"font family. This prevents users from building design systems that use custom fonts (e.g., brand typography like "Arbeit Pro", "Roboto", etc.).Addresses #138.
API
Fallback behavior
If the requested font is not available in Figma (not installed locally or not in the document), the plugin:
"Inter"(forcreate_text) or keeps the existing font (forset_text_content)This ensures backward compatibility — existing usage without
fontFamilycontinues to work exactly as before.Test plan
fontFamily) — should use Inter as beforefontFamily: "Roboto"— should use Roboto if availableset_text_contentwithfontFamilyto change an existing node's fontset_text_contentwithoutfontFamily— should preserve existing fontMade with Cursor