You are not logged in.

#1 2020-03-10 18:53:23

girzel
Member
Registered: 2010-06-27
Posts: 74

Configuring fonts under sway/wayland, HiDPI monitor

I've recently switched from X11/i3 to wayland/sway full time. It's been mostly fine so far, with the exception that I don't seem to be able to get generic fonts working right -- everything looks fuzzy. I use Termite, Emacs, and Firefox (occasionally Riot and Libreoffice), and while the fonts look great in Sway's own window decorations (and the swaybar) they look fuzzy everywhere else.

I'm using a Lenovo Thinkpad X1 carbon, starting sway directly from console, no desktop environment. The screen is HiDPI, and /sys/class/drm/card0-eDP-1/modes contains "2560X1440" (twice), which I think is correct.

Back when I was using X11 I had "Xft.dpi: 210" in my ~/.Xdefaults file, which seemed to work out fine. This whole thing started when Emacs dropped support for XFT, that was the first time I realized it was deprecated: apparently we're supposed to be using cairo/pango/harfbuzz. Now that I've moved to sway I removed the .Xdefaults file altogether. I've commented out the scaling directive in my sway config file. As far as I know, I haven't specified resolution or DPI anywhere (except I probably have, and just don't know it).

The verbose output of "swaymsg -t get_outputs" is below. I don't know how it knew to set a scaling factor of 2, but it did.

I have fontconfig installed, and I'm happy to use that (and pango/cairo/harfbuzz), so long as it works. I've tried:

ln -s /etc/fonts/conf.avail/10-hinting-full.conf ~/.config/fontconfig/conf.d/

So far as I can see, that did nothing. Maybe because the fonts are still getting 2X scaled somewhere? I have no idea.

swaymsg output:

[
   {
     "id": 3,
     "name": "eDP-1",
     "rect": {
       "x": 0,
       "y": 0,
       "width": 1280,
       "height": 720
     },
     "focus": [
       6,
       4,
       8,
       58
     ],
     "border": "none",
     "current_border_width": 0,
     "layout": "output",
     "orientation": "none",
     "percent": 1.0,
     "window_rect": {
       "x": 0,
       "y": 0,
       "width": 0,
       "height": 0
     },
     "deco_rect": {
       "x": 0,
       "y": 0,
       "width": 0,
       "height": 0
     },
     "geometry": {
       "x": 0,
       "y": 0,
       "width": 0,
       "height": 0
     },
     "window": null,
     "urgent": false,
     "floating_nodes": [
     ],
     "sticky": false,
     "type": "output",
     "active": true,
     "dpms": true,
     "primary": false,
     "make": "Panasonic Industry Company",
     "model": "0x96A2",
     "serial": "0x00000000",
     "scale": 2.0,
     "scale_filter": "nearest",
     "transform": "normal",
     "current_workspace": "2: emacs",
     "modes": [
       {
         "width": 2560,
         "height": 1440,
         "refresh": 48000
       },
       {
         "width": 2560,
         "height": 1440,
         "refresh": 59999
       }
     ],
     "current_mode": {
       "width": 2560,
       "height": 1440,
       "refresh": 59999
     },
     "max_render_time": 0,
     "focused": true,
     "subpixel_hinting": "unknown"
   }
 ]

Offline

#2 2020-03-11 21:06:13

girzel
Member
Registered: 2010-06-27
Posts: 74

Re: Configuring fonts under sway/wayland, HiDPI monitor

Okay, it looks like the problem is that all these applications are starting under xwayland, which means they're not really fully run by wayland. Termite is supposed to be wayland compatible but obviously is still using xwayland, Emacs never claimed to be wayland compatible, and while firefox says you can use MOZ_ENABLE_WAYLAND=1 to turn wayland support on, that doesn't work. At least, I have set that environment variable twenty different ways, and firefox ignores it every time.

So that's probably the source of my font weirdness.

Offline

Board footer

Powered by FluxBB