Skip to content

Instantly share code, notes, and snippets.

@kevinlekiller
Created December 24, 2022 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinlekiller/1706a913b07bd5c2ef50738209f78c55 to your computer and use it in GitHub Desktop.
Save kevinlekiller/1706a913b07bd5c2ef50738209f78c55 to your computer and use it in GitHub Desktop.
Fix font aliasing on flatpak GTK programs under Plasma. Create directory, for example ~/.var/app/io.gitlab.librewolf-community/config/fontconfig then put this file in it.
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<its:rules version="1.0" xmlns:its="http://www.w3.org/2005/11/its">
<its:translateRule selector="/fontconfig/*[not(self::description)]" translate="no"/>
</its:rules>
<!--
Artificial oblique for fonts without an italic or oblique version
-->
<match target="font">
<!-- check to see if the font is roman -->
<test name="slant">
<const>roman</const>
</test>
<!-- check to see if the pattern requested non-roman -->
<test name="slant" compare="not_eq" target="pattern">
<const>roman</const>
</test>
<!-- multiply the matrix to slant the font -->
<edit name="matrix" mode="assign">
<times>
<name>matrix</name>
<matrix>
<double>1</double>
<double>0.2</double>
<double>0</double>
<double>1</double>
</matrix>
</times>
</edit>
<!-- pretend the font is oblique now -->
<edit name="slant" mode="assign">
<const>oblique</const>
</edit>
<!-- and disable embedded bitmaps for artificial oblique -->
<edit name="embeddedbitmap" mode="assign">
<bool>false</bool>
</edit>
</match>
<!--
Synthetic emboldening for fonts that do not have bold face available
-->
<match target="font">
<!-- check to see if the weight in the font is less than medium which possibly need emboldening -->
<test name="weight" compare="less_eq">
<const>medium</const>
</test>
<!-- check to see if the pattern requests bold -->
<test name="weight" compare="more_eq" target="pattern">
<const>bold</const>
</test>
<!--
set the embolden flag
needed for applications using cairo, e.g. gucharmap, gedit, ...
-->
<edit name="embolden" mode="assign">
<bool>true</bool>
</edit>
<!--
set weight to bold
needed for applications using Xft directly, e.g. Firefox, ...
-->
<edit name="weight" mode="assign">
<const>bold</const>
</edit>
</match>
<match target="font">
<edit name="rgba" mode="assign">
<const>none</const>
</edit>
</match>
<match target="font">
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit name="hintstyle" mode="assign">
<const>hintslight</const>
</edit>
</match>
<match target="font">
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
</match>
<!-- Disable bitmap fonts. -->
<selectfont><rejectfont><pattern>
<patelt name="scalable"><bool>false</bool></patelt>
</pattern></rejectfont></selectfont>
</fontconfig>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment