Re: [hackers] [st] [PATCHv2] Work around BadLength error by disallowing color fonts

From: Laslo Hunhold <dev_AT_frign.de>
Date: Tue, 23 Apr 2019 22:57:36 +0200

On Tue, 23 Apr 2019 22:08:30 +0200
"Silvan Jegen" <s.jegen_AT_gmail.com> wrote:

Dear Silvan,

> From what I can tell, returning 1 in this case won't work because st
> calls die() when xloadfont returns non-0 at all call sites. We would
> have to load a fallback font instead, I think.

the failure case here is a result of bad user input (as the user
specified a font string that contains a colour font), but I agree that
this is better moved one level up so we can error out and say "better
not specify colour fonts, as it leads to crashes easily), at least
print a warn() or something, but I just kept a die() here.

> The dwm patch for for this issue [0] also adds this call to choose the
> fallback font.
>
> + FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
>
> We probably have to do the same in st.

This is a really good point! See attached version 2 of my patch
reflecting your suggestions.

With best regards

Laslo

-- 
Laslo Hunhold <dev_AT_frign.de>
Received on Tue Apr 23 2019 - 22:57:36 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 23 2019 - 23:00:27 CEST