Skill

Generate Makepad Font and Text Rendering Code

Skill for Makepad text and font rendering - SDF-based GPU text, font DSL styling, the Layouter API, and rasterizer settings.


71
Spark score
out of 100
Updated 10 days ago
Version 15.7.0
Models
claude

Add to Favorites

Why it matters

Leverage Makepad's advanced text rendering capabilities to generate code for configuring fonts, styling text, and implementing complex text layouts using GPU-accelerated techniques like Signed Distance Fields (SDF).

Outcomes

What it gets done

01

Configure font families, sizes, and styles in Makepad DSL.

02

Implement text layout and shaping using Makepad's Layouter API.

03

Generate code for GPU-based text rendering with SDF.

04

Understand and apply text styling properties and theme fonts.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-makepad-font | bash

Overview

Makepad Font Skill

A Makepad text/font rendering reference skill covering DSL text_style configuration, font prototype definitions, the Layouter API and layout parameters, and rasterizer/SDF/atlas settings for GPU-based text rendering. Use for Makepad font configuration, text layout/shaping, or SDF text rendering questions. Scoped to the font/text system specifically - not DSL composition, layout containers, animation, or shaders.

What it does

Makepad Font Skill is an expert reference for text and font rendering in the Makepad Rust UI framework, covering font configuration, text layout/shaping, and GPU-based text rendering via signed distance fields (SDF) (tracks the makepad-widgets dev branch). It generates font/text DSL and Rust code and explains the underlying font module architecture.

Before answering, it is instructed to read a local font-system.md reference file and incorporate its content, falling back to SKILL.md patterns plus built-in knowledge if the file is missing or empty (surfacing a documentation-sync command to the user in that case). It maps the text module's internal file structure - font.rs (handle/metrics), font_atlas.rs (GPU glyph texture atlas), font_face.rs, font_family.rs, fonts.rs (built-ins), glyph_outline.rs/glyph_raster_image.rs, layouter.rs (layout engine), rasterizer.rs, sdfer.rs (SDF generator), selection.rs, and shaper.rs (harfbuzz-based text shaping).

<Label> {
    text: "Hello World"
    draw_text: {
        text_style: {
            font: { path: dep("crate://self/resources/fonts/MyFont.ttf") }
            font_size: 16.0
            line_spacing: 1.5
            letter_spacing: 0.0
        }
        color: #FFFFFF
    }
}

It covers using fonts in DSL three ways: inline text_style configuration, theme fonts (<THEME_FONT_REGULAR> with a theme font-size variable), and defining reusable named font prototypes (FONT_REGULAR, FONT_BOLD) that reference embedded font paths via dep("crate://..."). The Layouter API is documented with its constructor and methods (define_font_family, define_font, get_or_layout, is_font_family_known) plus its layout parameter structs - OwnedLayoutParams (text, spans, options), Span/Style (font family, size, color per span), and LayoutOptions (max width for wrapping, wrap toggle, first-line indent). Rasterizer settings cover the default glyph cache size (4096), and SDF-specific tuning (padding, radius, cutoff) plus grayscale (4096x4096) and color/emoji (2048x2048) atlas dimensions.

It distinguishes the simple Label widget (plain text with a single style) from TextFlow for rich text composition with Bold, Italic, and Link (with an href) child elements. A text-properties table covers eight configurable properties: text, font, font_size, line_spacing, letter_spacing, color, brightness, and curve (a text-curve visual effect).

Six conceptual points guide question-answering: Makepad uses SDF for crisp text at any scale, fonts are loaded once and cached in GPU texture atlases, text shaping uses harfbuzz for correct glyph positioning, dep("crate://...") is the syntax for embedded font resources, the default font cache holds 4096 glyphs, and atlas sizes are 4096x4096 grayscale versus 2048x2048 for color/emoji glyphs.

When to use - and when NOT to

Use this skill for Makepad font configuration (families, sizes, styles), text layout and shaping questions, or GPU-based SDF text rendering tasks.

It is scoped to Makepad's text/font rendering system specifically, not DSL composition, layout containers, animation, events, or shaders covered by sibling Makepad skills. It is not a substitute for environment-specific validation, testing, or expert review - if local reference documentation is missing, it flags this explicitly rather than silently guessing beyond its built-in knowledge.

Inputs and outputs

Inputs: a request to configure font styling, define reusable font prototypes, or understand text layout/rasterization behavior in a Makepad app.

Outputs: DSL text_style blocks, font prototype definitions, and Layouter/rasterizer configuration matching the requested text behavior.

Integrations

Part of the Makepad skill family alongside basics, DSL, layout, animation, event/action, shader, deployment, and reference skills; references local font-system.md documentation kept in sync via a /sync-crate-skills makepad command; text shaping is powered by harfbuzz.

Who it's for

Makepad developers configuring fonts, tuning text rendering quality/performance, or building rich-text widgets who need the correct DSL and Layouter/rasterizer API usage.

FAQ

Common questions

Discussion

Questions & comments ยท 0

Sign In Sign in to leave a comment.