Font - Megatokio/kilipili GitHub Wiki

class Font and System Fonts

header file Graphics/Font.h

class Font provides a font together with meta data and pixel data. The pixel data is a bitmap[height][width] with height = char_height and width = 256\*char_width;

Currently only a subset of what can be declared here is supported by the CharMap and SimpleCharMap FrameBuffers:

  • row_offset = supported, dflt=256
  • first_glyph = 0
  • last_glyph = 255, other ignored
  • char_width = 8
  • char_height = supported, dflt=12
  • baseline = ignored, dflt=8
  • fixed_width = true

Currently predefined are 4 char sets:

  • latin1_12x8 character set incl. some useful graphics
  • ascii_12x8_inverse ascii character set, doubled with attribute inverse, incl. some useful graphics
  • ascii_12x8_bold ascii character set, doubled with attribute bold, incl. some useful graphics
  • graphics_12x8 pure graphics character set, mostly useful as second font in a CharMap.

Handling

The predefined fonts are located in flash. You should copy those which are used into RAM. That's the only reason why the copy constructor Font(const Font&) is provided.
However, if you are short of RAM you may display them directly from flash too.

Fonts should be handed around as a pointer. For safety and easy memory management use a smart pointer: RCPtr<Font>.

⚠️ **GitHub.com Fallback** ⚠️