Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requesting invalid xft fonts doesn't generate an error message #318

Open
dkogan opened this issue Feb 21, 2021 · 3 comments
Open

Requesting invalid xft fonts doesn't generate an error message #318

dkogan opened this issue Feb 21, 2021 · 3 comments

Comments

@dkogan
Copy link
Contributor

dkogan commented Feb 21, 2021

Hi. Somebody just asked for xft support in the Debian notion package, so I rebuilt it, and ran some tests. The xft support works, but the error reporting isn't working properly. If I ask for a font "xft:bogus" which doesn't exist, I get SOME xft font (presumably a fall-back), but notion doesn't report the failure anywhere. This makes it difficult to know when it "worked", and when it didn't. Errors loading non-xft fonts ARE reported in the logs, in ~/.xsession-errors on Debian.

Thanks.

@wilhelmy
Copy link
Collaborator

wilhelmy commented Mar 13, 2021

I took a look at the code. Xft fonts are loaded along the other fonts in in de/font.c and it seems like XftFontOpenName does not return NULL in case an invalid Xft font specifier is found.

    if(strncmp(fontname, "xft:", 4)==0){
        font=XftFontOpenName(ioncore_g.dpy, DefaultScreen(ioncore_g.dpy), fontname+4);
    // some lines omitted
    if(font==NULL){

This thread suggests ditching Xft altogether and using cairo/pango or harfbuzz instead:
https://xorg.freedesktop.narkive.com/4nxqqQiX/xft-problem-with-xftfontopenname-and-xftfontopen-functions

However I'm not sure whether that's the solution someone here will be eager to go for.

https://www.x.org/releases/X11R7.6/doc/man/man3/Xft.3.xhtml does not seem to mention anything about fallback fonts...

@raboof
Copy link
Owner

raboof commented Mar 14, 2021

This thread suggests ditching Xft altogether and using cairo/pango or harfbuzz instead

Hmm, I'd prefer not to add further dependencies, and we haven't noticed much of the limitations of using xft directly...

@wilhelmy
Copy link
Collaborator

Haven't seen buggy window titles even with UTF-8 involved in a while, so maybe harfbuzz/pango are overrated. :)

I've definitely seen the fallback font behaviour with other software that uses Xft (urxvt). Not sure how to work around it. Asked on Freenode #xorg-devel but no response so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants