hamza
hamza copied to clipboard
Fast C OpenType Library
Hamza
Hamza is a light-weight, fast and portable C99 OpenType shaping and rendering library. It's built alongside the stb_truetype.h TrueType library. It's designed to be a small, portable and optimized shaper that's easy to integrate into an existing project. Originally Hamza was a research project to learn about font shaping for an Arabic calligraphy software I had in mind. Later, with much research and work I have only developed more fascination with the general shaping process and possible strategies of optimization.
Objective
- Keep the library as a whole excluding backends and auto-generated tables under 10k SLOC.
- The goal is a non-pessimized, small and simple shaping library that can easily be included into any existing project.
- The intent is to optimize lookup application slow paths using SIMD + multi-threading while keeping the code as simple and clear as possible. Many think that shaping is a linear process and very difficult to multi-thread, this couldn't be further from the truth. GSUB table single substitution as an example is a perfect use-case for multi-threading, Unicode parsing can be vectorized and ligature matching can be optimized with SSE.
- Support for ASCII, Latin1, UTF-8, UTF-16, UTF-32, UCS2 and Johab encodings.
- For the renderer; an efficient MSDF dynamic cache on GPU using compute.
- Ability to render semi-transparent cursive text, soft shadows as well as proper outlining.
Features
- [x] Joining script support and RTL writing
- [x] Kerning
- [x] Ligatures
- [x] Support for new OpenType language tags (mixture of ISO 639-3 and ISO 639-2 codes)
- [ ] Support for old Two-Letter ISO 639-1:2002 language tags (same as HarfBuzz)
- [ ] Vertical layout (i.e. for Chinese)
- [ ] Emojis
- [ ] Multi-Threading
Script Support
- [x] Standard Scripts (Latin, Cyrillic, Greek, etc)
- [x] Arabic
- [ ] Buginese
- [ ] Hangul
- [ ] Hebrew
- [ ] Indic
- [ ] Bengali
- [ ] Devanagari
- [ ] Gujarati
- [ ] Gurmukhi
- [ ] Kannada
- [ ] Malayalam
- [ ] Odia
- [ ] Tamil
- [ ] Telugu
- [ ] Javanese
- [ ] Khmer
- [ ] Lao
- [ ] Myanmar
- [ ] Sinhala
- [ ] Syriac
- [ ] Thaana
- [ ] Thai
- [ ] Tibetan
Usage
For usage of API functions, check hz.h
and respective files. There is also documentation at https://saidwho12.github.io/hamza/.
Misc
Developed and maintained by Saïd Metiche.