makepad-font
CRITICAL: Use for Makepad font and text rendering. Triggers on: makepad font, makepad text, makepad glyph, makepad typography, font atlas, text layout, font family, font size, text shaping, makepad 字体, makepad 文字, makepad 排版, makepad 字形
About this skill
This critical AI skill imbues the agent with specialized expertise in Makepad's intricate font and text rendering systems. It enables the agent to provide in-depth assistance and guidance on topics such as configuring font families, sizes, and styles; understanding text layout and shaping processes; and explaining GPU-based text rendering techniques using Signed Distance Fields (SDF). The skill is designed to activate when relevant keywords like 'makepad font', 'text layout', 'font atlas', or 'makepad typography' are detected, ensuring precise and context-aware support for developers working with Makepad.
Best use case
Developers working with Makepad who require assistance with font integration, custom text rendering, optimizing text performance, or debugging display issues related to typography within their Makepad applications.
CRITICAL: Use for Makepad font and text rendering. Triggers on: makepad font, makepad text, makepad glyph, makepad typography, font atlas, text layout, font family, font size, text shaping, makepad 字体, makepad 文字, makepad 排版, makepad 字形
Users can expect clear, accurate, and detailed guidance on Makepad font and text rendering, helping them configure fonts, understand layout principles, and implement advanced rendering techniques effectively.
Practical example
Example input
How do I configure a custom font family and size for a Text widget in Makepad, and what are the best practices for GPU-based text rendering using SDF?
Example output
To set a custom font family and size in Makepad, you typically define your font assets and then specify them within your widget's properties, often in a `Text` component. For example, you might use `text: { font_family: 'MyCustomFont', font_size: 14 }`. For GPU-based text rendering, Makepad leverages Signed Distance Fields (SDF) to render crisp text at various scales efficiently. Best practices include pre-generating font atlases, optimizing SDF generation parameters, and ensuring proper shader integration for anti-aliasing. Would you like a more detailed explanation of SDF implementation or a code snippet for font configuration?When to use this skill
- Use this skill when you need to configure fonts in a Makepad project, understand how Makepad handles text layout, implement custom text rendering, troubleshoot font display problems, or learn about GPU-based text rendering (SDF) within the Makepad framework.
When not to use this skill
- Do not use this skill for general font rendering questions outside the Makepad ecosystem, for tasks unrelated to text and typography, or when seeking to perform an action (like generating a font file) rather than receiving expert advice or explanation.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/makepad-font/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How makepad-font Compares
| Feature / Agent | makepad-font | Standard Approach |
|---|---|---|
| Platform Support | Claude | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | easy | N/A |
Frequently Asked Questions
What does this skill do?
CRITICAL: Use for Makepad font and text rendering. Triggers on: makepad font, makepad text, makepad glyph, makepad typography, font atlas, text layout, font family, font size, text shaping, makepad 字体, makepad 文字, makepad 排版, makepad 字形
Which AI agents support this skill?
This skill is designed for Claude.
How difficult is it to install?
The installation complexity is rated as easy. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# Makepad Font Skill
> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-19
>
> Check for updates: https://crates.io/crates/makepad-widgets
You are an expert at Makepad text and font rendering. Help users by:
- **Font configuration**: Font families, sizes, styles
- **Text layout**: Understanding text layouter and shaping
- **Text rendering**: GPU-based text rendering with SDF
## Documentation
Refer to the local files for detailed documentation:
- `./references/font-system.md` - Font module structure and APIs
## IMPORTANT: Documentation Completeness Check
**Before answering questions, Claude MUST:**
1. Read the relevant reference file(s) listed above
2. If file read fails or file is empty:
- Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"
- Still answer based on SKILL.md patterns + built-in knowledge
3. If reference file exists, incorporate its content into the answer
## Text Module Structure
```
draw/src/text/
├── font.rs # Font handle and metrics
├── font_atlas.rs # GPU texture atlas for glyphs
├── font_face.rs # Font face data
├── font_family.rs # Font family management
├── fonts.rs # Built-in fonts
├── glyph_outline.rs # Glyph vector outlines
├── glyph_raster_image.rs # Rasterized glyph images
├── layouter.rs # Text layout engine
├── rasterizer.rs # Glyph rasterization
├── sdfer.rs # Signed distance field generator
├── selection.rs # Text selection/cursor
├── shaper.rs # Text shaping (harfbuzz)
```
## Using Fonts in DSL
### Text Style
```rust
<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
}
}
```
### Theme Fonts
```rust
<Label> {
text: "Styled Text"
draw_text: {
text_style: <THEME_FONT_REGULAR> {
font_size: (THEME_FONT_SIZE_P)
}
}
}
```
## Font Definition in DSL
```rust
live_design! {
// Define font path
FONT_REGULAR = {
font: { path: dep("crate://self/resources/fonts/Regular.ttf") }
}
FONT_BOLD = {
font: { path: dep("crate://self/resources/fonts/Bold.ttf") }
}
// Use in widget
<Label> {
draw_text: {
text_style: <FONT_REGULAR> {
font_size: 14.0
}
}
}
}
```
## Layouter API
```rust
pub struct Layouter {
loader: Loader,
cache_size: usize,
cached_params: VecDeque<OwnedLayoutParams>,
cached_results: HashMap<OwnedLayoutParams, Rc<LaidoutText>>,
}
impl Layouter {
pub fn new(settings: Settings) -> Self;
pub fn rasterizer(&self) -> &Rc<RefCell<Rasterizer>>;
pub fn is_font_family_known(&self, id: FontFamilyId) -> bool;
pub fn define_font_family(&mut self, id: FontFamilyId, definition: FontFamilyDefinition);
pub fn define_font(&mut self, id: FontId, definition: FontDefinition);
pub fn get_or_layout(&mut self, params: impl LayoutParams) -> Rc<LaidoutText>;
}
```
## Layout Parameters
```rust
pub struct OwnedLayoutParams {
pub text: Substr,
pub spans: Box<[Span]>,
pub options: LayoutOptions,
}
pub struct Span {
pub style: Style,
pub len: usize,
}
pub struct Style {
pub font_family_id: FontFamilyId,
pub font_size_in_pts: f32,
pub color: Option<Color>,
}
pub struct LayoutOptions {
pub max_width_in_lpxs: Option<f32>, // Max width for wrapping
pub wrap: bool, // Enable word wrap
pub first_row_indent_in_lpxs: f32, // First line indent
}
```
## Rasterizer Settings
```rust
pub struct Settings {
pub loader: loader::Settings,
pub cache_size: usize, // Default: 4096
}
pub struct rasterizer::Settings {
pub sdfer: sdfer::Settings {
padding: 4, // SDF padding
radius: 8.0, // SDF radius
cutoff: 0.25, // SDF cutoff
},
pub grayscale_atlas_size: Size::new(4096, 4096),
pub color_atlas_size: Size::new(2048, 2048),
}
```
## DrawText Widget
```rust
<View> {
// Label is a simple text widget
<Label> {
text: "Simple Label"
draw_text: {
color: #FFFFFF
text_style: {
font_size: 14.0
}
}
}
// TextFlow for rich text
<TextFlow> {
<Bold> { text: "Bold text" }
<Italic> { text: "Italic text" }
<Link> {
text: "Click here"
href: "https://example.com"
}
}
}
```
## Text Properties
| Property | Type | Description |
|----------|------|-------------|
| `text` | String | Text content |
| `font` | Font | Font resource |
| `font_size` | f64 | Size in points |
| `line_spacing` | f64 | Line height multiplier |
| `letter_spacing` | f64 | Character spacing |
| `color` | Vec4 | Text color |
| `brightness` | f64 | Text brightness |
| `curve` | f64 | Text curve effect |
## When Answering Questions
1. Makepad uses SDF (Signed Distance Field) for crisp text at any scale
2. Fonts are loaded once and cached in GPU texture atlases
3. Text shaping uses harfbuzz for proper glyph positioning
4. Use `dep("crate://...")` for embedded font resources
5. Default font cache size is 4096 glyphs
6. Atlas sizes: 4096x4096 for grayscale, 2048x2048 for color (emoji)
## When to Use
Use this skill when tackling tasks related to its primary domain or functionality as described above.Related Skills
makepad-platform
CRITICAL: Use for Makepad cross-platform support. Triggers on: makepad platform, makepad os, makepad macos, makepad windows, makepad linux, makepad android, makepad ios, makepad web, makepad wasm, makepad metal, makepad d3d11, makepad opengl, makepad webgl, OsType, CxOs, makepad 跨平台, makepad 平台支持
makepad-layout
CRITICAL: Use for Makepad layout system. Triggers on: makepad layout, makepad width, makepad height, makepad flex, makepad padding, makepad margin, makepad flow, makepad align, Fit, Fill, Size, Walk, "how to center in makepad", makepad 布局, makepad 宽度, makepad 对齐, makepad 居中
makepad-animation
CRITICAL: Use for Makepad animation system. Triggers on: makepad animation, makepad animator, makepad hover, makepad state, makepad transition, "from: { all: Forward", makepad pressed, makepad 动画, makepad 状态, makepad 过渡, makepad 悬停效果
moodle-external-api-development
This skill guides you through creating custom external web service APIs for Moodle LMS, following Moodle's external API framework and coding standards.
mobile-developer
Develop React Native, Flutter, or native mobile apps with modern architecture patterns. Masters cross-platform development, native integrations, offline sync, and app store optimization.
graphql-architect
Master modern GraphQL with federation, performance optimization, and enterprise security. Build scalable schemas, implement advanced caching, and design real-time systems.
git-pr-workflows-pr-enhance
You are a PR optimization expert specializing in creating high-quality pull requests that facilitate efficient code reviews. Generate comprehensive PR descriptions, automate review processes, and ensu
git-advanced-workflows
Master advanced Git techniques to maintain clean history, collaborate effectively, and recover from any situation with confidence.
debugging-toolkit-smart-debug
Use when working with debugging toolkit smart debug
debugger
Debugging specialist for errors, test failures, and unexpected behavior. Use proactively when encountering any issues.
conductor-setup
Configure a Rails project to work with Conductor (parallel coding agents)
comprehensive-review-pr-enhance
Generate structured PR descriptions from diffs, add review checklists, risk assessments, and test coverage summaries. Use when the user says "write a PR description", "improve this PR", "summarize my changes", "PR review", "pull request", or asks to document a diff for reviewers.