unifont
- Unifont is a compact and embeddable terminal 1-bpp font library (C++11).
- Unifont is handy. It supports most european/greek/cyrillic unicode codepoints.
- Unifont is tiny (~400 LOC), header-only, portable and cross-platform.
- Unifont is aimed to gamedev and debugging sessions.
- Unifont is zlib/libpng licensed.
- Instance an
unifont(color *framebuffer, unsigned width, color (*make_rgba)(r,g,b,a))
class.
- While using an unifont class, the external framebuffer must point to a valid memory address.
- Then use following methods as desired:
render_string(x,y,style,const char* utf8);
render_string(x,y,style,const char* utf8, const color &c);
render_string(x,y,style,const char* utf8, const color* gradient8x8);
render_string(x,y,style,const vector<int> &codepoints);
render_string(x,y,style,const vector<int> &codepoints, const color &c);
render_string(x,y,style,const vector<int> &codepoints, const color* gradient8x8);
- Style is an
enum { NORMAL, INVERT, SHADOW, RETRO }
flag mask.
- All methods return an
struct { unsigned w, h; }
dimensions rectangle.
- For a more detailed sample check sample.cc file.