1
0
mirror of https://github.com/jjsullivan5196/wvkbd.git synced 2025-03-13 02:42:47 +01:00
Frank Oltmanns d6439afcb9 Make font selection scheme specific
Add the members font and font_descriptor to struct clr_scheme, so that
it is possible to specify a font for each scheme.

During initialization create the font descriptors for each scheme.

Instead of initially setting the font descriptor when setting up the
buffer, set the font descriptor when drawing the text.

Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2023-10-29 13:07:57 +01:00

49 lines
1.3 KiB
C

#ifndef __DRW_H
#define __DRW_H
#include <pango/pangocairo.h>
#include <stdbool.h>
struct drw {
struct wl_shm *shm;
};
struct drwsurf {
uint32_t width, height, size;
double scale;
struct drw *ctx;
struct wl_surface *surf;
struct wl_buffer *buf;
struct wl_shm *shm;
unsigned char *pool_data;
cairo_t *cairo;
PangoLayout *layout;
};
struct kbd;
void drwsurf_resize(struct drwsurf *ds, uint32_t w, uint32_t h, double s);
void drwsurf_flip(struct drwsurf *ds);
typedef union {
uint8_t bgra[4];
uint32_t color;
} Color;
void drw_do_clear(struct drwsurf *d, uint32_t x, uint32_t y,
uint32_t w, uint32_t h);
void drw_do_rectangle(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
uint32_t w, uint32_t h, bool fill);
void drw_fill_rectangle(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
uint32_t w, uint32_t h);
void drw_over_rectangle(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
uint32_t w, uint32_t h);
void drw_draw_text(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
uint32_t w, uint32_t h, uint32_t b, const char *label,
PangoFontDescription *font_description);
uint32_t setup_buffer(struct drwsurf *drwsurf);
#endif