fd.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef _FD_H
  2. #define _FD_H
  3. #include <stdint.h>
  4. /* font decode */
  5. struct fd_struct
  6. {
  7. unsigned target_x;
  8. unsigned target_y;
  9. unsigned is_transparent;
  10. unsigned x; /* local coordinates, (0,0) is upper left */
  11. unsigned y;
  12. unsigned glyph_width;
  13. unsigned glyph_height;
  14. const uint8_t *decode_ptr; /* pointer to the compressed data */
  15. unsigned decode_bit_pos; /* bitpos inside a byte of the compressed data */
  16. unsigned decode_byte;
  17. uint8_t glyph_cnt;
  18. uint8_t bits_per_0;
  19. uint8_t bits_per_1;
  20. uint8_t bits_per_char_width;
  21. uint8_t bits_per_char_height;
  22. uint8_t bits_per_char_x;
  23. uint8_t bits_per_char_y;
  24. uint8_t bits_per_delta_x;
  25. uint8_t char_width;
  26. uint8_t char_height;
  27. uint8_t char_descent;
  28. unsigned capital_a_pos;
  29. unsigned small_a_pos;
  30. uint8_t *font;
  31. };
  32. typedef struct fd_struct fd_t;
  33. void fd_init(fd_t *fd);
  34. void fd_set_font(fd_t *fd, uint8_t *font);
  35. unsigned fd_draw_glyph(fd_t *fd, unsigned x, unsigned y, uint8_t encoding);
  36. unsigned fd_draw_string(fd_t *fd, unsigned x, unsigned y, const char *s);
  37. #endif /* _FD_H */