mirror of
https://github.com/jjsullivan5196/wvkbd.git
synced 2025-07-13 06:24:29 +02:00
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>
This commit is contained in:
committed by
Maarten van Gompel
parent
6e52be343d
commit
d6439afcb9
7
drw.c
7
drw.c
@ -30,11 +30,14 @@ drwsurf_flip(struct drwsurf *ds)
|
||||
|
||||
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)
|
||||
uint32_t w, uint32_t h, uint32_t b, const char *label,
|
||||
PangoFontDescription *font_description)
|
||||
{
|
||||
|
||||
cairo_save(d->cairo);
|
||||
|
||||
pango_layout_set_font_description(d->layout, font_description);
|
||||
|
||||
cairo_set_source_rgba(
|
||||
d->cairo, color.bgra[2] / (double)255, color.bgra[1] / (double)255,
|
||||
color.bgra[0] / (double)255, color.bgra[3] / (double)255);
|
||||
@ -134,8 +137,6 @@ setup_buffer(struct drwsurf *drwsurf)
|
||||
cairo_scale(drwsurf->cairo, drwsurf->scale, drwsurf->scale);
|
||||
cairo_set_antialias(drwsurf->cairo, CAIRO_ANTIALIAS_NONE);
|
||||
drwsurf->layout = pango_cairo_create_layout(drwsurf->cairo);
|
||||
pango_layout_set_font_description(drwsurf->layout,
|
||||
drwsurf->ctx->font_description);
|
||||
pango_layout_set_auto_dir(drwsurf->layout, false);
|
||||
cairo_save(drwsurf->cairo);
|
||||
|
||||
|
Reference in New Issue
Block a user