Solved Ugly fonts rendering pixelated

I recently reinstalled FreeBSD after a hardware change and I have now ugly and pixelated fonts.
System reports
Code:
FreeBSD 14.2-RELEASE-p1 FreeBSD 14.2-RELEASE-p1 GENERIC
Sway WM 1.10.1
nvidia-drm-61-kmod-570.124.04.1402000_1

Fonts look ok in some applications, but otherwise pixelated on most:

1744709391174.png


Here are the contents of .Xressources:

Code:
! FONTS
! -----------------------------------------------------------------------------
Xft.antialias:  1
Xft.hinting:    1
Xft.hintstyle:  hintslight
Xft.dpi:        96
Xft.rgba:       rgba
Xft.lcdfilter:  lcddefault
Xft.autohint:   1

gkt-3/settings.ini
Code:
[Settings]
gtk-application-prefer-dark-theme=true
gtk-button-images=true
gtk-cursor-theme-name=breeze_cursors
gtk-cursor-theme-size=24
gtk-decoration-layout=icon:minimize,maximize,close
gtk-enable-animations=true
gtk-font-name=Noto Sans,  11
gtk-icon-theme-name=breeze-dark
gtk-menu-images=true
gtk-modules=colorreload-gtk-module:window-decorations-gtk-module
gtk-primary-button-warps-slider=true
gtk-sound-theme-name=ocean
gtk-theme-name=Breeze
gtk-toolbar-style=3
gtk-xft-dpi=98304

sway/config:
Code:
output * subpixel bgr
output * render_bit_depth 10
output * adaptive_sync off
output DP-3 resolution 5120x1440@144hz pos 0 0 enable

The same happens on XFCE4 on Wayland.

How do I fix it?
 
Hmm, I had already rebuilt fontconfig WITHOUT BITMAPS, but I had indeed a bunch of bitmaps fonts installed.
I removed it all, restarted the session, but I see not improvement:

1744728257449.png
 
Did you also disable embeddedbitmap via fonts-conf(5)? It's separate from regular bitmap fonts. Otherwise, you'd need to debug fontconfig:
Code:
$ fc-match monospace
$ fc-match sans-serif
$ fc-match serif
$ fc-match -v | egrep '(alias|bitmap|outline)'

Beware, some X11 applications don't support fontconfig or prefer legacy X11 font rendering. If this is undesired make sure Xwayland only has "built-ins" in the font path.
Code:
# List of font directories that may be used for server-side rendering (doesn't support antialising)
$ xset q | sed -n '/Font Path/,/:/p'
 
Embedded bitmaps are disabled:

Code:
$ fc-match -v | egrep '(alias|bitmap|outline)'
    antialias: True(w)
    outline: True(s)
    embeddedbitmap: False(w)

However, font directories for server-side rendering are present, I guess leftovers of the bitmap fonts I had installed before?
Code:
$ xset q | sed -n '/Font Path/,/^ /p'
Font Path:
  /usr/local/share/fonts/misc/,/usr/local/share/fonts/TTF/,/usr/local/share/fonts/OTF/,/usr/local/share/fonts/Type1/,/usr/local/share/fonts/100dpi/,/usr/local/share/fonts/75dpi/,catalogue:/usr/local/etc/X11/fontpath.d,built-ins

Is it safe to remove those?
 
Some of those font directories (like TTF and OTF) may be used by non-bitmap fonts. Empty ones with just fonts.* files are safe to remove. Before removing you can test by disabling X11 fonts (except embedded) for the currently running Xwayland instance:
Code:
$ xset fp= built-ins
$ xlsfonts
-misc-fixed-medium-r-semicondensed--0-0-75-75-c-0-iso8859-1
-misc-fixed-medium-r-semicondensed--13-100-100-100-c-60-iso8859-1
-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
6x13
cursor
fixed
 
Unfortunately, no luck:

Code:
$ xset fp= built-ins

$ xlsfonts
-misc-fixed-medium-r-semicondensed--0-0-75-75-c-0-iso8859-1
-misc-fixed-medium-r-semicondensed--13-100-100-100-c-60-iso8859-1
-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
6x13
cursor
fixed

1744738492580.png


I rebuilt Sway WITHOUT X11 support and the result is the same!?!
 
What launcher is that? Can you reproduce with something like pango-view(1)? For one, gtk-font-name has no effect on non-Gtk apps but you've never shown fc-match(1) output for aliases like monospace, sans-serif, serif.
The launcher is x11/wofi
My mistake, I forgot to report on the results of fc-match:
Code:
$ fc-match monospace && fc-match sans-serif && fc-match serif
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
DejaVuSans.ttf: "DejaVu Sans" "Book"
DejaVuSerif.ttf: "DejaVu Serif" "Book"

And this is the result of pango-view :

1744754485702.png
 
It turns out, it was a silly mistake: when restoring the dotfiles, I intentionally omitted.gtkrc-2 wrongly assuming that gtk3 and gtk4 applications would take precedence on font rendering. That is clearly not the case, which explains why some applications looked just fine while others didn't.
 
Back
Top