On Tue, Apr 23, 2019 at 10:14:32AM +0200, Laslo Hunhold wrote:
> Dear fellow hackers,
>
> this patch will hopefully resolve the many mails we get on dev_AT_ and
> hackers_AT_ regarding crashes of st due to emoji-fonts triggering some
> voodoo-condition in Xft.
>
> I hope my port of Anselm's change to dwm to st is correct and would
> love to hear feedback.
>
> With best regards
>
> Laslo Hunhold
>
> --
> Laslo Hunhold <dev_AT_frign.de>
> From 69cfb2193f5e7bb8dda42b3dc5474e3d04170ad1 Mon Sep 17 00:00:00 2001
> From: Laslo Hunhold <dev_AT_frign.de>
> Date: Tue, 23 Apr 2019 10:02:14 +0200
> Subject: [PATCH] Work around BadLength error by disallowing color fonts
>
> This problem has given us enough trouble on the ML alone and is a
> bug in the Xft library that probably won't ever be fixed.
>
> This change is a port of Anselm's commit to dwm
> (cb3f58ad06993f7ef3a7d8f61468012e2b786cab).
> ---
> LICENSE | 4 ++--
> x.c | 12 ++++++++++++
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/LICENSE b/LICENSE
> index c356c39..07518e3 100644
> --- a/LICENSE
> +++ b/LICENSE
> _AT_@ -4,7 +4,7 @@ MIT/X Consortium License
> ?? 2018 Devin J. Pohly <djpohly at gmail dot com>
> ?? 2014-2017 Quentin Rameau <quinq at fifth dot space>
> ?? 2009-2012 Aur??lien APTEL <aurelien dot aptel at gmail dot com>
> -?? 2008-2017 Anselm R Garbe <garbeam at gmail dot com>
> +?? 2008-2019 Anselm R Garbe <garbeam at gmail dot com>
> ?? 2012-2017 Roberto E. Vargas Caballero <k0ga at shike2 dot com>
> ?? 2012-2016 Christoph Lohmann <20h at r-36 dot net>
> ?? 2013 Eon S. Jeon <esjeon at hyunmu dot am>
> _AT_@ -13,7 +13,7 @@ MIT/X Consortium License
> ?? 2013-2014 Eric Pruitt <eric.pruitt at gmail dot com>
> ?? 2013 Michael Forney <mforney at mforney dot org>
> ?? 2013-2014 Markus Teich <markus dot teich at stusta dot mhn dot de>
> -?? 2014-2015 Laslo Hunhold <dev at frign dot de>
> +?? 2014-2019 Laslo Hunhold <dev at frign dot de>
>
> Permission is hereby granted, free of charge, to any person obtaining a
> copy of this software and associated documentation files (the "Software"),
> diff --git a/x.c b/x.c
> index 5828a3b..074df47 100644
> --- a/x.c
> +++ b/x.c
> _AT_@ -837,12 +837,24 @@ xgeommasktogravity(int mask)
> int
> xloadfont(Font *f, FcPattern *pattern)
> {
> + FcBool iscol;
> FcPattern *configured;
> FcPattern *match;
> FcResult result;
> XGlyphInfo extents;
> int wantattr, haveattr;
>
> + /* 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.
> + */
> + if(FcPatternGetBool(pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
> + return 1;
> + }
> +
> /*
> * Manually configure instead of calling XftMatchFont
> * so that we can use the configured pattern for
> --
> 2.21.0
>
I'm not in favor of this. I think this should be fixed upstream.
Now that there has been a release of dwm and dmenu with the workaround it
should be removed I think.
There is no nice workaround except making the code more ugly. Should every
project using fontconfig add this stupid workaround? I don't think so. One of
the things that flow from the UNIX philosophy as I see it is solving things at
the appropriate layer (or try to).
There have also been reports of FC_COLOR patch "not working", because distros (in
particular Debian stable, Slackware etc) using 4+ year old backported
fontconfig versions. FC_COLOR is not known there. #define FC_COLOR "color" is
a workaround which does not fix anything except make it compile. It will still
crash there.
The whole concept of colored fonts is anti-suckless and retarded in general.
--
Kind regards,
Hiltjo
Received on Wed Apr 24 2019 - 21:47:39 CEST