Add a configuration to switch to monospace if spacing=100 is requested

Previously, requesting a monospace font with an invalid font family
(for instance, when a font is not embedded in a PDF, poppler may
issue such queries), the font family would be filled by configuration
file 49-sansserrif.conf with sans-serif
This new rule set the family to monospace if spacing=100 is specified
in the query.
This commit is contained in:
Pierre Ducroquet 2021-08-21 15:45:50 +02:00
parent 7b09c81dab
commit 3fcdd60a1d
1 changed files with 25 additions and 0 deletions

25
conf.d/48-spacing.conf Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<description>Add mono to the family when no generic name and spacing is 100</description>
<!--
If the font has no generic name and spacing 100, add mono
-->
<match target="pattern">
<test qual="all" name="family" compare="not_eq">
<string>sans-serif</string>
</test>
<test qual="all" name="family" compare="not_eq">
<string>serif</string>
</test>
<test qual="all" name="family" compare="not_eq">
<string>monospace</string>
</test>
<test qual="all" name="spacing" compare="eq">
<int>100</int>
</test>
<edit name="family" mode="append_last">
<string>monospace</string>
</edit>
</match>
</fontconfig>