dwm-noxz

[fork] suckless dwm - personal fork
git clone https://noxz.tech/git/dwm-noxz.git
dwm-noxz

commit: eb5c5a2ff99198d02af8d8b2441a1c6e520aac19
parent: ba6c0542ec0e92f109a948563e5617358d709813
author: Chris Noxz <chris@noxz.tech>
date:   Fri, 30 Jun 2023 11:52:02 +0200
Add support for color fonts
Mconfig.def.h4+++-
Mdrw.c14--------------
2 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -11,7 +11,8 @@ static int topbar               = 1;        /* 0 means bottom bar */
 static int viewontag            = 1;
 static int focusonwheel         = 0;
 static char font[256]           = "dnoxz_numerics:pixelsize=12:autohint=false";
-static char *fonts[]            = { font };
+static char font_emoji[256]     = "Noto Color Emoji:pixelsize=10:antialias=true:autohint=true";
+static char *fonts[]            = { font, font_emoji };
 
 static char col_none[]          = COL_DEF;
 static char col_nbr[]           = COL_DEF;
@@ -134,6 +135,7 @@ ResourcePref resources[] = {
 	{ "statusNotifyForeground",     STRING,     &col_snofg },
 	{ "statusNotifyBackground",     STRING,     &col_snobg },
 	{ "font",                       STRING,     &font },
+	{ "fontEmoji",                  STRING,     &font_emoji },
 	{ "borderpx",                   INTEGER,    &borderpx },
 	{ "snap",                       INTEGER,    &snap },
 	{ "gap",                        INTEGER,    &gap },
diff --git a/drw.c b/drw.c
@@ -133,19 +133,6 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
 		die("no font specified.");
 	}
 
-	/* 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
-	 * https://lists.suckless.org/dev/1701/30932.html
-	 * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
-	 * and lots more all over the internet.
-	 */
-	FcBool iscol;
-	if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
-		XftFontClose(drw->dpy, xfont);
-		return NULL;
-	}
-
 	font = ecalloc(1, sizeof(Fnt));
 	font->xfont = xfont;
 	font->pattern = pattern;
@@ -352,7 +339,6 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
 			fcpattern = FcPatternDuplicate(drw->fonts->pattern);
 			FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
 			FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
-			FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
 
 			FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
 			FcDefaultSubstitute(fcpattern);