From 1a7c45e4f22b11111bb1bb607beb964da34fc444 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Fri, 29 May 2020 20:33:20 +0200 Subject: [PATCH] Adding color emoji patch --- README.md | 6 +++++- drw.c | 4 +++- patches.def.h | 8 ++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0f7f3e4..e852fff 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Refer to [https://tools.suckless.org/dmenu/](https://tools.suckless.org/dmenu/) ### Changelog: -2020-05-29 - Added the alpha patch (derived from Baitinq's [build](https://github.com/Baitinq/dmenu)) +2020-05-29 - Added the alpha patch (derived from Baitinq's [build](https://github.com/Baitinq/dmenu)) and the color emoji patch 2020-04-05 - Added fuzzyhighlight patch @@ -38,6 +38,10 @@ Refer to [https://tools.suckless.org/dmenu/](https://tools.suckless.org/dmenu/) - [center](https://tools.suckless.org/dmenu/patches/center/) - this patch centers dmenu in the middle of the screen + - color_emoji + - enables color emoji in dmenu by removing a workaround for a BadLength error in the Xft library when color glyphs are used + - enabling this will crash dmenu on encountering such glyphs unless you also have an updated Xft library that can handle them + - [fuzzyhighlight](https://tools.suckless.org/dmenu/patches/fuzzyhighlight/) - intended to be combined with the fuzzymatch patch, this makes it so that fuzzy matches are highlighted diff --git a/drw.c b/drw.c index 7656600..fecbb4e 100644 --- a/drw.c +++ b/drw.c @@ -149,6 +149,7 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern) die("no font specified."); } + #if !COLOR_EMOJI_PATCH /* Do not allow using color fonts. This is a workaround for a BadLength * error from Xft with color glyphs. Modelled on the Xterm workaround. See * https://bugzilla.redhat.com/show_bug.cgi?id=1498269 @@ -161,6 +162,7 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern) XftFontClose(drw->dpy, xfont); return NULL; } + #endif // COLOR_EMOJI_PATCH font = ecalloc(1, sizeof(Fnt)); font->xfont = xfont; @@ -477,4 +479,4 @@ drw_cur_free(Drw *drw, Cur *cursor) #if SCROLL_PATCH #include "patch/scroll.c" -#endif \ No newline at end of file +#endif diff --git a/patches.def.h b/patches.def.h index 0d15f06..5e520aa 100644 --- a/patches.def.h +++ b/patches.def.h @@ -17,6 +17,14 @@ */ #define CENTER_PATCH 0 +/* This patch enables color emoji in dmenu by removing a workaround for a BadLength error + * in the Xft library when color glyphs are used. + * To enable this you will need an updated Xft library that can handle color glyphs otherwise + * the program will crash on encountering such characters. Note that you will also need a font + * that provides color emojis for this to work. + */ +#define COLOR_EMOJI_PATCH 0 + /* This patch make it so that fuzzy matches gets highlighted and is therefore meant * to be used together with the fuzzymatch patch. * https://tools.suckless.org/dmenu/patches/fuzzyhighlight/