Renders font glyphs on the GPU by slicing them into monotone pieces.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
font-slicer.xcodeproj
include
source
.gitignore
LICENSE
README.md
font_slicer.cpp
font_slicer.h
main.cpp

README.md

font-slicer

font-slicer renders freely scalable font glyphs using the GPU.

It takes an approach similar to CPU rasterisation, by 'slicing' each glyph's outline into y-monotone pieces. Each slice is trapezoidal - it has a horizontal top and bottom edge, and left and right edges which are quadratic Bézier curves.

Each slice is rendered by the GPU as a quad. The vertex shader snaps the quad to pixel boundaries to ensure that each pixel potentially covered by the slice is considered.

The pixel shader calculates an approximation of the exact coverage of the slice on the pixel. The pixel is treated as a square, and the slice is clipped to it. The curved edges of the slice are flattened to lines, to produce a true trapezoid, and the percentage coverage of the trapezoid on the square is output from the shader.

OpenGL's built-in sRGB handling performs gamma correction on the text for display.

The text rendered by font-slicer is freely scalable, but cannot be rotated. I present it here as a potential solution for rasterising text on the GPU, as an an alternative to texture atlases, SDFs, glyphy, or Loop-Blinn.

To compile, you will need to link to FreeType.