genart.dev
Plugins

Typography

Text rendering with OpenType.js — kerning, optical alignment, type scales, and text-to-path conversion.

Text rendering with OpenType.js integration. Features metrics-based and optical kerning, modular type scales, glyph classification, and SVG path conversion. 3 bundled variable fonts plus system fallbacks.

Installation

npm install @genart-dev/plugin-typography

Layer Types

Type IDDisplay NameDescription
typography:textTextStyled text with font, kerning, optical alignment, and shadow controls

Properties

typography:text

PropertyTypeDefaultDescription
contentstring""Text content to render
fontFamilystring"Inter"Font family name
fontSizenumber24Font size in pixels
fontWeightselect"normal"Weight: normal, bold, 100–900
fontStyleselect"normal"Style: normal, italic
colorcolor"#000000"Text fill color
textAlignselect"left"Alignment: left, center, right
lineHeightnumber1.4Line height multiplier
letterSpacingnumber0Letter spacing in pixels
kerningModeselect"metrics"Kerning: none, metrics, optical
opticalAlignmentbooleanfalseEnable optical overshoot compensation
maxWidthnumber0Max width for wrapping (0 = no wrap)
strokeColorcolor""Text stroke color
strokeWidthnumber0Text stroke width
shadowEnabledbooleanfalseEnable text shadow
shadowColorcolor"#00000040"Shadow color with alpha
shadowOffsetXnumber2Shadow horizontal offset
shadowOffsetYnumber2Shadow vertical offset
shadowBlurnumber4Shadow blur radius

Built-In Fonts

FontTypeWeightsNotes
Intersans-serif400, 700Variable font bundled
JetBrains Monomonospace400Variable font bundled
Source Serif 4serif400Variable font bundled
Georgia, Arial, Helvetica, Times New Roman, Courier NewsystemvariesSystem fallbacks

MCP Tools

ToolDescription
set_textSet text content on a typography layer
apply_text_styleApply font family, size, weight, color, and alignment
list_fontsList available font families
set_text_shadowConfigure text shadow properties
set_type_scaleGenerate modular type scale (8 named ratios: minor-second through golden)
get_font_metricsDetailed metrics: ascender, descender, xHeight, capHeight, kern pairs
analyze_text_spacingAnalyze kerning quality with per-pair metrics and divergence warnings
convert_text_to_pathsConvert text layer to SVG path data
load_custom_fontLoad OTF/TTF/WOFF2 from sketch asset

Example

{
  "tool": "design_add_layer",
  "arguments": {
    "type": "typography:text",
    "properties": {
      "content": "Hello World",
      "fontFamily": "Source Serif 4",
      "fontSize": 48,
      "fontWeight": "bold",
      "color": "#1a1a2e",
      "kerningMode": "optical",
      "opticalAlignment": true,
      "textAlign": "center"
    }
  }
}