gfxfont.h 1.1 KB

1234567891011121314151617181920212223242526272829
  1. // Font structures for newer Adafruit_GFX (1.1 and later).
  2. // Example fonts are included in 'Fonts' directory.
  3. // To use a font in your Arduino sketch, #include the corresponding .h
  4. // file and pass address of GFXfont struct to setFont(). Pass NULL to
  5. // revert to 'classic' fixed-space bitmap font.
  6. #ifndef _GFXFONT_H_
  7. #define _GFXFONT_H_
  8. /// Font data stored PER GLYPH
  9. typedef struct {
  10. uint16_t bitmapOffset; ///< Pointer into GFXfont->bitmap
  11. uint8_t width; ///< Bitmap dimensions in pixels
  12. uint8_t height; ///< Bitmap dimensions in pixels
  13. uint8_t xAdvance; ///< Distance to advance cursor (x axis)
  14. int8_t xOffset; ///< X dist from cursor pos to UL corner
  15. int8_t yOffset; ///< Y dist from cursor pos to UL corner
  16. } GFXglyph;
  17. /// Data stored for FONT AS A WHOLE
  18. typedef struct {
  19. uint8_t *bitmap; ///< Glyph bitmaps, concatenated
  20. GFXglyph *glyph; ///< Glyph array
  21. uint8_t first; ///< ASCII extents (first char)
  22. uint8_t last; ///< ASCII extents (last char)
  23. uint8_t yAdvance; ///< Newline distance (y axis)
  24. } GFXfont;
  25. #endif // _GFXFONT_H_