#ifndef FONT_H #define FONT_H #include "stm32f1xx.h" typedef struct { uint16_t bitmapOffset;// Pointer into `bitmaps` array uint8_t width;// Bitmap width in pixels uint8_t height;// Bitmap height in pixels uint8_t advance;// Cursor advance after this glyph int8_t xOffset;// X offset from cursor position int8_t yOffset;// Y offset from baseline } GFXglyph; typedef struct { const uint8_t *bitmaps;// Glyph bitmaps (combined into one array) const GFXglyph *glyphs;// Glyph metadata uint16_t firstChar;// First character in the font (e.g., 0x20 for space) uint16_t lastChar;// Last character in the font (e.g., 0x7E for ~) uint8_t yAdvance;// Vertical distance to advance for newline } GFXfont; void GFX_DrawChar( uint16_t x, uint16_t y, char c, const GFXfont *font, uint16_t fg_color, uint16_t bg_color); uint16_t GFX_GetTextWidth(const char *text, const GFXfont *font); // Alignment: 0 => Left, 1 => Center, 2 => Right void GFX_DrawText( uint16_t x, uint16_t y, const char *text, const GFXfont *font, uint16_t fg_color, uint16_t bg_color, uint8_t alignment); #endif