r-lyeh-archived / unifont

Embeddable console 1bpp font that supports many european/eastern unicode codepoints. Aimed to gamedev (C++11).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

api

  • 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.

preview

image

notes

licenses

changelog

  • v1.0.0 (2015/05/05)
    • initial revision

About

Embeddable console 1bpp font that supports many european/eastern unicode codepoints. Aimed to gamedev (C++11).

License:zlib License


Languages

Language:C 74.0%Language:C++ 26.0%