From 35ff74c9be46e16030d1184a506451e1d3805c25 Mon Sep 17 00:00:00 2001 From: gamerdonkey Date: Sat, 14 Sep 2024 14:48:59 -0500 Subject: First attempt at integrating Adafruit_GFX and converting to C++ --- main/gfxfont.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 main/gfxfont.h (limited to 'main/gfxfont.h') diff --git a/main/gfxfont.h b/main/gfxfont.h new file mode 100644 index 0000000..175bad6 --- /dev/null +++ b/main/gfxfont.h @@ -0,0 +1,29 @@ +// Font structures for newer Adafruit_GFX (1.1 and later). +// Example fonts are included in 'Fonts' directory. +// To use a font in your Arduino sketch, #include the corresponding .h +// file and pass address of GFXfont struct to setFont(). Pass NULL to +// revert to 'classic' fixed-space bitmap font. + +#ifndef _GFXFONT_H_ +#define _GFXFONT_H_ + +/// Font data stored PER GLYPH +typedef struct { + uint16_t bitmapOffset; ///< Pointer into GFXfont->bitmap + uint8_t width; ///< Bitmap dimensions in pixels + uint8_t height; ///< Bitmap dimensions in pixels + uint8_t xAdvance; ///< Distance to advance cursor (x axis) + int8_t xOffset; ///< X dist from cursor pos to UL corner + int8_t yOffset; ///< Y dist from cursor pos to UL corner +} GFXglyph; + +/// Data stored for FONT AS A WHOLE +typedef struct { + uint8_t *bitmap; ///< Glyph bitmaps, concatenated + GFXglyph *glyph; ///< Glyph array + uint16_t first; ///< ASCII extents (first char) + uint16_t last; ///< ASCII extents (last char) + uint8_t yAdvance; ///< Newline distance (y axis) +} GFXfont; + +#endif // _GFXFONT_H_ -- cgit v1.2.3