As outlined here.
First move aside whatever there is in ~/.config/fontconfig and ~/.local/share/fonts (although these do not exist by default in SFOS).
Then:
cd ~
curl -LO https://github.com/dumol/PixelPerfect/releases/download/v0.4.0beta2/PixelPerfect-hidpi-0.4beta2.tar.gz
tar xvfz PixelPerfect-hidpi-0.4beta2.tar.gz
This does two things:
Installs a ton of fonts:
find ~/.local/share/fonts/ -type f -iname '*\.[ot]tf'| wc -l
691
du -sh ~/.local/share/fonts/
169.0M /home/defaultuser/.local/share/fonts/
Creates a fontconfig configuration in ~/.config/fontconfig.
Usually this is just one file: fonts.conf, but in this setup this file
includes many other files.
PS: the PixelPerfect package works on all OSs that use fontconfig.
In my opinion, this setup is overkill. Most of it is geared towards web browsers resp. websites anyhow.
Some of it will interfere with SFOS internals, e.g. the Terminal’s (fingerterm) side menu.
Here’s what I recommend: keep the fonts if you can spare the storage, but move them out of the way and create a new
~/.local/share/fonts directory that contains only what is being substituted:
cd ~/.local/share/fonts && find -type f -iname '*\.[ot]tf'
./PT-Sans/PT-Sans_Bold-Italic.ttf
./PT-Sans/PT-Sans_Bold.ttf
./PT-Sans/PT-Sans_Regular.ttf
./PT-Sans/PT-Sans_Narrow-Regular.ttf
./PT-Sans/PT-Sans_Narrow-Bold.ttf
./PT-Sans/PT-Sans_Italic.ttf
./PT-Sans/PT-Sans_Caption-Bold.ttf
./PT-Sans/PT-Sans_Caption-Regular.ttf
./source-sans-3v028R/SourceSans3-Regular.ttf
./source-sans-3v028R/SourceSans3-Bold.ttf
./source-sans-3v028R/SourceSans3-It.ttf
./source-sans-3v028R/SourceSans3-BoldIt.ttf
./NotoEmoji-Regular.ttf
./Abel-Regular.ttf
Then move ~/.config/fontconfig/fonts.conf out of the way and create a new
~/.config/fontconfig/fonts.conf:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<description>Settings for Sailfish OS setups</description>
<!-- Set default UI typeface. -->
<alias binding="strong">
<family>Sail Sans Pro Light</family>
<prefer>
<family>Abel</family>
<family>emoji</family>
<family>PT Sans</family>
<family>Source Sans 3</family>
</prefer>
</alias>
<!-- Ignore default UI font -->
<selectfont>
<rejectfont>
<glob>/usr/share/fonts/sail-sans-pro</glob>
</rejectfont>
</selectfont>
</fontconfig>
This is now the only fontconfig configuration used; you may remove all the rest, recursively.
“Abel” is my choice; the PixelPerfect repo uses “Barlow” by default.
Go to Settings => Utilities (comes pre-installed nowadays) and restart your Home screen, or
systemctl --user restart lipstick
It might be prudent to also run
fc-cache -fv
If you want to also change the default terminal font, insert this block before </fontconfig>:
<!-- Set default monospace typeface. -->
<alias binding="strong">
<family>DejaVu Sans Mono</family>
<prefer>
<family>Iosevka</family>
</prefer>
</alias>
<alias binding="strong">
<family>monospace</family>
<prefer>
<family>Iosevka</family>
</prefer>
</alias>
<!-- Ignore default monospace font -->
<selectfont>
<rejectfont>
<glob>/usr/share/fonts/dejavu</glob>
</rejectfont>
</selectfont>
I have chosen “Iosevka” which is narrow by default, good for a terminal in portrait mode. However, I had to use an old version because the newest messes up the terminal app fingerterm and/or toeterm. I suspect they introduced some features that aren’t compatible with SFOS’ Qt version, sometime in 2016. I didn’t trace this down to the closest release, but this one works:
cd ~/.local/share/fonts
curl -L https://github.com/be5invis/Iosevka/releases/download/v1.6.2/iosevka-1.6.2.zip -o iosevka.zip
unzip iosevka.zip && rm iosevka.zip


The font is thicker now. If you want a thinner font you need
to choose that but also remove the regular variant of the chosen font.
But a thicker font enables one to reduce screen brightness more, I think I like that.
Terminal:


OK it seems Iosevka is a little smaller alround, but it’s still more condensed.
..of all fonts provided by the PixelPerfect package can be found here.
This was created with the fontview script from here (or here) which you can copy to your phone along with the desktop file, which will allow you to open fonts from the file browser.