slug-font-rendering
Reference HLSL shader implementations for the Slug font rendering algorithm, enabling high-quality GPU-accelerated vector font and glyph rendering.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/adisinghstudent/slug-font-renderingSlug Font Rendering Algorithm
Skill by ara.so — Daily 2026 Skills collection.
Slug is a reference implementation of the Slug font rendering algorithm — a GPU-accelerated technique for rendering vector fonts and glyphs at arbitrary scales with high quality anti-aliasing. It works by encoding glyph outlines as lists of quadratic Bézier curves and line segments, then resolving coverage directly in fragment shaders without pre-rasterized textures.
Paper: JCGT 2017 — Slug Algorithm
Blog (updates): A Decade of Slug
License: MIT — Patent dedicated to public domain. Credit required if distributed.
What Slug Does
- Renders TrueType/OpenType glyphs entirely on the GPU
- No texture atlases or pre-rasterization needed
- Scales to any resolution without quality loss
- Anti-aliased coverage computed per-fragment using Bézier math
- Works with any rendering API that supports programmable shaders (D3D11/12, Vulkan, Metal via translation)
Repository Structure
Slug/
├── slug.hlsl # Core fragment shader — coverage computation
├── band.hlsl # Band-based optimization for glyph rendering
├── curve.hlsl # Quadratic Bézier and line segment evaluation
├── README.md
Installation / Integration
Slug is a reference implementation — you integrate the HLSL shaders into your own rendering pipeline.
Step 1: Clone the Repository
git clone https://github.com/EricLengyel/Slug.git
Step 2: Include the Shaders
Copy the .hlsl files into your shader directory and include them in your pipeline:
#include "slug.hlsl"
#include "curve.hlsl"
Step 3: Prepare Glyph Data on the CPU
You must preprocess font outlines (TrueType/OTF) into Slug's curve buffer format:
- Decompose glyph contours into quadratic Bézier segments and line segments
- Upload curve data to a GPU buffer (structured buffer or texture buffer)
- Precompute per-glyph "band" metadata for the band optimization
Core Concepts
Glyph Coordinate System
- Glyph outlines live in font units (typically 0–2048 or 0–1000 per em)
- The fragment shader receives a position in glyph space via interpolated vertex attributes
- Coverage is computed by counting signed curve crossings in the Y direction (winding number)
Curve Data Format
Each curve entry in the GPU buffer stores:
// Line segment: p0, p1
// Quadratic Bézier: p0, p1 (control), p2
struct CurveRecord
{
float2 p0; // Start point
float2 p1; // Control point (or end point for lines)
float2 p2; // End point (unused for lines — flagged via type)
// Type/flags encoded separately or in padding
};
Band Optimization
The glyph bounding box is divided into horizontal bands. Each band stores only the curves that intersect it, reducing per-fragment work from O(all curves) to O(local curves).
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-adisinghstudent-slug-font-rendering": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
Oh My Openagent Omo
Skill by adisinghstudent
Planning With Files Manus Workflow
Skill by adisinghstudent
mirofish-offline-simulation
Fully local multi-agent swarm intelligence simulation engine using Neo4j + Ollama for public opinion, market sentiment, and social dynamics prediction.
ghostling-libghostty-terminal
Build minimal terminal emulators using the libghostty-vt C API with Raylib for windowing and rendering
Obra Superpowers Agentic Workflow
Skill by adisinghstudent