⚠️ Patent Update ⚠️

March 17, 2026 · View on GitHub

You don't need to worry about the patent anymore!
See why in the patent section below.

Presentation

This is a toy/experimental project showing off how to get started rendering glyphs with Eric Lengyel's Slug algorithm on both CPUs and GPUs. This old project was a quick prototype to evaluate the rendering algorithm. I've made it public in the hope it could serve as a useful learning resource.

I recommend reading at least the slides linked in the references section before any of the code.

Requirements

  • Windows x64
  • Visual C++ 2013 or later for compiling
  • OpenGL 3.2 for the hardware renderer

Project breakdown

Sub-projectPurpose
Font generatorReads a .ttf TrueType font file and outputs a .sluggish file
Software rendererReads a .sluggish file and outputs a .tga image per specified code point
Hardware rendererReads a .sluggish file and renders up to 6 specified glyphs using OpenGL
FeatureSupport
Curves texture (FP32)YES
Bands texture (U16)YES
Cutting glyphs into bands (performance)YES
Sorting curves (performance)YES
High-quality implementation of anythingNO
High performanceNO
16-bit floating point encodingNO
Data de-duplication and compressionNO
Text layoutingNO
Colored shapesNO
Adaptive super-samplingNO
Gamma correctionNO
Bounding polygonsNO

The goal was to keep things pretty simple while still not having awful performance. For instance, cutting the glyphs into bands has been implemented because it's simple and improves performance massively.

Debugging

By default, the debugger's target executable isn't in the output directory but a directory path specified by the SLUGGISH_APP_DIR environment variable.

The .exe and .pdb files are copied over to that directory after every build.

To make this process easy, you can launch Visual Studio through a simple batch script:

:: This file would sit next to the Sluggish directory
cd Sluggish\makefiles\vs2013
set SLUGGISH_APP_DIR=C:\important_stuff\sluggish
Sluggish.sln

References

To learn more about how the Slug algorithm works, refer to:
GPU-Centered Font Rendering Directly from Glyph Outlines by Eric Lengyel
Journal of Computer Graphics Techniques (JCGT), vol. 6, no. 2, 31-47, 2017
Paper: http://jcgt.org/published/0006/02/02
Slides: http://terathon.com/i3d2018_lengyel.pdf

Eric Lengyel's 2019 article about dynamic glyph dilation:
https://terathon.com/blog/glyph-dilation.html

Eric Lengyel's 2026 open sourced implementations of the vertex and pixel shaders:
https://github.com/EricLengyel/Slug

Eric Lengyel's 2026 article about rendering improvements:
https://terathon.com/blog/decade-slug.html
The changes are:

  • added dynamic glyph dilation
  • removed adaptive supersampling
  • removed band split optimization

Licenses

Project/FileLicense(s)License File(s)
This projectUnlicense (public domain)UNLICENSE.MD
SDL 2zliblibs/SDL2/COPYING.txt
GLEWModified BSD License
Mesa 3-D License (MIT)
Khronos License (MIT)
libs/GLEW/LICENSE.txt
premake 5premake 5makefiles/PREMAKE_LICENSE.txt
stb_truetype.hPick-a-license:
Unlicense (public domain)
MIT
code/generator/stb_truetype.h
stb_image_write.hPick-a-license:
Unlicense (public domain)
MIT
code/renderer_sw/stb_image_write.h

Patent

As of March 17 2026, Eric Lengyel announced that he is "permanently and irrevocably dedicating the Slug patent to the public domain". He also wrote that "anybody can freely implement the Slug algorithm from this day forward without a license for whatever purpose they want, and they don’t need to worry about infringing upon any intellectual property rights." For more details on the legalese of that change, refer to:
https://terathon.com/blog/decade-slug.html

Patent: https://patents.google.com/patent/US10373352B1

History:

  • 2018-02-01: application filed
  • 2019-08-06: application granted
  • 2026-03-17: form SB/43 filed