Shaping Libraries
HarfBuzz
-
HarfBuzz .
-
Complex shaping.
-
For serious text (RTL, ligatures, etc.): FreeType + HarfBuzz , optionally MSDF for rendering.
-
HarfBuzz won't help you with bidirectionality.
-
HarfBuzz won't help you with text that contains different font properties.
-
HarfBuzz won't help you with line breaking, hyphenation, or justification.
Core Text
-
Shaping engine.
DirectWrite
-
Shaping engine.
Uniscribe
-
Shaping engine.
-
Microsoft.
Segmentation Libraries
Fribidi
-
Fribidi .
-
It only implements direction breaking.
-
ICU
-
ICU .
-
Is a very complex and featureful library. However, it is restricted to offering Unicode functionality, and, as we have seen, text shaping and rasterization both require OpenType functionality.
-
It performs segmentation.
Rasterization Libraries
FreeType2
-
FreeType .
-
FreeType .
-
Written in C.
-
What it is :
-
A mature, open-source library for font rendering, supporting TrueType, OpenType, PostScript, and many other font formats.
-
Advanced hinting, subpixel rendering, kerning, ligatures, and DPI-aware scaling. Used widely in professional software (e.g., Linux, Android, Godot).
-
"rasterization library".
-
FreeType is a font rendering engine , meaning it:
-
Parses font files (e.g., TTF, OTF)
-
Extracts glyph data (metrics, outlines, bitmaps)
-
Generates glyph images (rasterizes vector outlines into bitmaps or provides outline vectors for further use)
-
-
-
What it does :
-
It provides bitmap glyphs (e.g., 8-bit grayscale bitmaps) or vector outlines (e.g., curves and points).
-
It lets you rasterize a glyph at a specific size and resolution into a memory buffer.
-
The output of
FT_Render_Glyphis a rasterized glyph image stored in theglyph->bitmapfield of theFT_GlyphSlotstructure.-
Nothing more than "bitmap data".
-
In the Odin example,
bitmap_datais a[]RGBA, whereRGBA :: [4]u8, with sizebitmap_data = make([]RGBA, window_width * window_height).
-
-
-
What it doesn't do :
-
It does not handle drawing to the screen (no OpenGL, DirectX, Vulkan, etc.).
-
It does not handle text layout (no kerning application, line wrapping, or shaping for complex scripts — although it provides raw kerning info).
-
-
Use Case :
-
Production-grade applications where text quality and typographic features are critical.
-
Godot
-
Aligns with its focus on cross-platform compatibility and high-quality UI/text rendering.
-
-
stb_truetype
-
A single-file, public-domain C library for rasterizing TrueType (.ttf) fonts.
-
Pros :
-
Lightweight, easy to integrate, minimal dependencies.
-
-
Cons :
-
Limited features (basic hinting, no subpixel rendering), lower quality at small sizes, and no support for OpenType (.otf) or other font formats.
-
Does not automatically handle DPI scaling, as it requires explicit input for font size.
-
-
Use Case :
-
Ideal for small projects, prototyping, or platforms where simplicity and size matter more than typographic perfection.
-
RayLib.
-
However, RayLib itself allows developers to manually adjust font sizes based on DPI if needed.
-
"Is there a technical reason for not using freetype? I don't know much about the subject, so I'm just wandering"
-
library size, Freetype is x100 bigger than stb_truetype; build complexity, maintenance.
-
-
-
-
"stb_truetype is more limited and lower quality than FreeType2" :
-
This is broadly true.
stb_truetypeis a minimalist library focused on basic font rasterization, whileFreeType2is a full-featured, industry-standard library with advanced rendering capabilities (e.g., subpixel rendering, better hinting, and support for complex font features). For simple use cases,stb_truetypemay suffice, butFreeType2generally produces higher-quality results, especially at small font sizes or on low-resolution displays.
-
Multi-Purpose Libraries
Pango
-
It can do all the steps for a Modern Text Processing Pipeline.
-
Pango .
kb-text-shape
-
Segmentation (through kbts_Break) and shaping (through kbts_Shape).
-
Now part of Odin's vendor.
-
The library basically does everything you need to go from UTF-8 or Unicode codepoints to a list of glyph indices + positions, ready to send to a rasterizer like FreeType or stb_truetype.
-
Features :
-
Segmentation :
-
Provides ICU-like text segmentation (i.e. breaking Unicode text by direction, line, word and grapheme).
-
-
Shaping :
-
It also provides HarfBuzz-like text shaping for OpenType fonts, which means it is capable of handling complex script layout and ligatures, among other things.
-
-
Bundling segmentation and shaping simplifies the overall implementation, because the shaper doesn't need any ad-hoc adjustments to fix bad segmentation.
-
It also reduces the binary size by a lot, because they both share the same Unicode tables!
-
It can replace fribidi, some parts of ICU and HarfBuzz, but not Pango. Pango is a higher-level library that also handles paragraph layout and rendering glyphs to bitmaps, which we don't do.
-
-
Not-features :
-
Rasterization :
-
It does not handle rasterization.
-
It will only help you know which glyphs to display where!
-
-
-
Nic Barker: "Amazing work on this".