ValveSoftware / SteamOS

SteamOS community tracker
1.48k stars 69 forks source link

Steam desktop mode font rendering looks awful in stable Steamdeck OLED #1484

Open lifeiscontent opened 3 weeks ago

lifeiscontent commented 3 weeks ago

Your system information

Please describe your issue in as much detail as possible:

Describe what you expected should happen and what did happen.

Steps for reproducing this issue:

  1. download chrome
  2. browse the web
  3. watch your eyes bleed

Steps for fixing:

update ~/.fonts.conf


 <?xml version='1.0'?>
 <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
 <fontconfig>
+ <match target="font">
+  <edit mode="assign" name="rgba">
+   <const>rgb</const>
+  </edit>
+ </match>
+ <match target="font">
+  <edit mode="assign" name="hinting">
+   <bool>true</bool>
+  </edit>
+ </match>
+ <match target="font">
+  <edit mode="assign" name="hintstyle">
+   <const>hintslight</const>
+  </edit>
+ </match>
  <dir>~/.fonts</dir>
+ <match target="font">
+  <edit mode="assign" name="antialias">
+   <bool>true</bool>
+  </edit>
+ </match>
 </fontconfig>```
Sunspark-007 commented 2 weeks ago

I can help you with this because I've spent a lot of time with this.

To start with, don't use rgb in the rgba section. Neither the lcd or oled ones are rgb. The lcd one is v-bgr (because it's rgb rotated) and the oled is pentile. Instead, what you should use is "none" which would be greyscale. (N.B. if you're using an external display, then it's fine to use RGB since that's the layout most, but not all, external displays are.)

You should also experiment with not using hinting either, depending on the font being used, you might have better results if it's not trying to fit to a pixel grid when you're not using a stripe layout.

lifeiscontent commented 2 weeks ago

@Sunspark-007 do you have a config I can copy/paste I'm so far removed from this kind of stuff that I have no idea what you're talking about 😅

Sunspark-007 commented 2 weeks ago

Sure, here is my .fonts.conf

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <dir>~/.fonts</dir>
 <match target="font">
  <edit name="lcdfilter" mode="assign">
   <const>lcdnone</const>
  </edit>
 </match>
 <match target="font">
  <edit name="autohint" mode="assign">
   <bool>false</bool>
  </edit>
 </match>
 <match target="font">
  <edit name="hinting" mode="assign">
   <bool>true</bool>
  </edit>
 </match>
 <match target="font">
  <edit name="hintstyle" mode="assign">
   <const>hintfull</const>
  </edit>
 </match>
 <match target="font">
  <edit name="rgba" mode="assign">
   <const>none</const>
  </edit>
 </match>
 <match target="font">
  <edit name="embeddedbitmap" mode="assign">
   <bool>false</bool>
  </edit>
 </match>
 <match target="font">
  <edit name="antialias" mode="assign">
   <bool>true</bool>
  </edit>
 </match>
</fontconfig>

In addition to that, in the directory /home/deck/.config/plasma-workspace/env make a textfile ending in .sh, name doesn't matter, can be variables.sh if you like. Add these following variables into it.

export FREETYPE_PROPERTIES='cff:no-stem-darkening=0 autofitter:no-stem-darkening=0 type1:no-stem-darkening=0 t1cid:no-stem-darkening=0'
export gtk-hint-font-metrics=1
export QT_ENABLE_HIGHDPI_SCALING=0
export KWIN_DRM_PREFER_COLOR_DEPTH=24

Save, reboot, and see how it is for you.

PS. That last one, KWIN_DRM_PREFER_COLOR_DEPTH value of 24 is for 8-bit and value of 30 is for 10-bit. I am skeptical that a value of 30 will be better with the current setup, but you can experiment and see both now and later.

Oh yeah, one more thing, to make Xft match, you may need to change a fonts setting in the control panel and then change it back in order to make everything match .fonts.conf. The command is "xrdb -query" but the KDE settings doesn't pick up lcdfilter, so you need to make another file, call it .XResources in the home directory after you've done the former, and put this line in it "Xft.lcdfilter: lcdnone" and then type "xrdb -merge ~/.Xresources" You only need to do this once.. afterward you can look at xrdb -query to make sure it looks at least like this

Xft.antialias:  1
Xft.hinting:    1
Xft.hintstyle:  hintfull
Xft.lcdfilter:  lcdnone
Xft.rgba:       none

Don't worry about the additional lines like dpi, cursor, etc. all that is automatically updated by the kde settings.

You may also wish to experiment with hinting set to false, but on my LCD (deck and monitor both) I am better off with it set to true.