font_info.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #pragma once
  2. #include <stdint.h>
  3. struct FontCharInfo_s {
  4. /**
  5. * @brief Width of the character
  6. */
  7. uint8_t width;
  8. /**
  9. * @brief Offset of the character's bitmap, in bytes, into the the data array
  10. */
  11. uint16_t offset;
  12. } __attribute__((packed));
  13. typedef struct FontCharInfo_s FontCharInfo;
  14. typedef struct {
  15. /**
  16. * @brief Font name
  17. */
  18. char* name;
  19. /**
  20. * @brief Font characters height
  21. */
  22. uint8_t height;
  23. /**
  24. * @brief The first character available in the font
  25. */
  26. uint8_t start_char;
  27. /**
  28. * @brief The last character available in the font
  29. */
  30. uint8_t end_char;
  31. /**
  32. * @brief Space character width
  33. */
  34. uint8_t space_width;
  35. /**
  36. * @brief Pointer to array of char information
  37. */
  38. FontCharInfo* char_info;
  39. /**
  40. * @brief Pointer to generated array of character visual representation
  41. */
  42. uint8_t* data;
  43. } FontInfo;
  44. /**
  45. * @brief Allocates a new instance of \c FontInfo
  46. * @return pointer to allocated instance
  47. */
  48. FontInfo* totp_font_info_alloc();
  49. /**
  50. * @brief Disposes all the resources allocated by the given \c FontInfo instance
  51. * @param font_info instance to dispose
  52. */
  53. void totp_font_info_free(FontInfo* font_info);