JimmyLefevre/kb
Freekb single-header C/C++ libraries
FreeFree tier
About JimmyLefevre/kb
kb is a collection of single-header, permissively-licensed C/C++ libraries focused on text processing. The main library, kb_text_shape.h, provides Unicode text segmentation (by direction, line, script, word, and grapheme) and OpenType shaping, enabling complex script layout and ligature handling. It also includes font coverage checking to determine if a font can display a given string. kb does not handle rasterization, paragraph layout, or system font selection; it focuses on determining which glyphs to display where on a single, infinitely-long line using user-provided fonts. The library is designed for integration into larger text rendering pipelines.
Key Features
Unicode text segmentation: breaks text by direction, line, script, word, and grapheme
OpenType shaping: supports complex script layout and ligatures
Font coverage checking: determines if a font can display a given string
Single-header design: easy integration into C/C++ projects
Permissive Zlib license
Does not handle rasterization, paragraph layout, or system font selection
Pros & Cons
Pros
- Single-header library simplifies integration
- Permissive Zlib license allows use in proprietary projects
- Handles complex scripts like Arabic, Myanmar, etc.
- Provides both text segmentation and OpenType shaping in one library
- Active community on GitHub with over 1,100 stars
Cons
- Does not handle paragraph layout or line breaking beyond hard breaks
- Does not include font loading or rasterization (user must provide font files and rendering)
- Limited to a single infinite line – no multi-line layout support
- Requires C/C++ knowledge for integration
Best For
Implementing text rendering in custom UI frameworks or game enginesBuilding text layout engines that require complex script supportAdding Unicode text segmentation to C/C++ applicationsChecking font coverage for multilingual text display
FAQ
What does kb_text_shape.h provide?
It provides ICU-like Unicode text segmentation (by direction, line, script, word, and grapheme) and Harfbuzz-like text shaping for OpenType fonts, including complex script layout and ligatures. It also offers font coverage checking.
Does kb handle font rasterization or paragraph layout?
No. kb does not handle rasterization, paragraph layout, or system font selection. It only helps determine which glyphs to display where on a single, infinitely-long line using fonts you provide.
What license is kb released under?
kb is released under the permissive Zlib license.
Is kb written as a single file?
Yes, it is a single-header library (one .h file) for easy integration into C/C++ projects.