dtext.h 818 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* See LICENSE file for copyright and license details. */
  2. typedef int32_t dt_error;
  3. typedef struct {
  4. FT_Library ft_lib;
  5. XRenderPictFormat *win_format;
  6. XRenderPictFormat *argb32_format;
  7. Display *dpy;
  8. Picture pic;
  9. Picture fill;
  10. } dt_context;
  11. typedef struct {
  12. FT_Face face;
  13. GlyphSet gs;
  14. uint8_t loaded[256];
  15. } dt_font;
  16. typedef struct {
  17. uint8_t red;
  18. uint8_t green;
  19. uint8_t blue;
  20. uint8_t alpha; // 0 means opaque
  21. } dt_style;
  22. dt_error dt_init(dt_context **ctx, Display *dpy, Window win);
  23. dt_error dt_quit(dt_context *ctx);
  24. dt_error dt_load(dt_context *ctx, dt_font **fnt,
  25. uint8_t size, char const *name);
  26. dt_error dt_free(dt_context *ctx, dt_font *fnt);
  27. dt_error dt_draw(dt_context *ctx, dt_font *fnt, dt_style const *style,
  28. uint32_t x, uint32_t y, char const *txt);