[Fontconfig] Query for unknown font with spacing=mono returns sans-serif font

Christian Weiske cweiske at cweiske.de
Tue Nov 9 12:12:28 UTC 2021


Hello,


Could someone please have a look at this problem?


Am Sat, 16 Oct 2021 22:02:58 +0200
schrieb Christian Weiske <cweiske at cweiske.de>:

> Hello,
> 
> 
> Some PDFs use monspaced fonts but do not embed them. The german bank
> "Volksbank" is one of those (they use "RFont0" up to "RFont8", and
> their meaning is different from file to file, i.e. RFont3 may be
> monospaced in one file, but normal spaced in the next. So no hard
> mapping possible here).
> 
> poppler queries fontconfig, by setting the name
> and the spacing=mono flag.
> (https://gitlab.freedesktop.org/poppler/poppler/-/issues/1152)
> Unfortunately, fontconfig returns the default sans-serif font (On
> Debian unstable and Ubuntu 20.04):
> 
> > $ fc-match RFont3:spacing=mono
> > DejaVuSans.ttf: "DejaVu Sans" "Book"  
> 
> 
> Shouldn't fontconfig return a monospaced font if an unknown font name
> is requested and the mono spacing flag is set?
> 
> I managed to fix that with the following user configuration:
> ----
> <?xml version='1.0'?>
> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
> <fontconfig>
>     <match target="pattern">
>      <test name="spacing">
>       <int>100</int>
>      </test>
>      <edit name="family" mode="prepend">
>       <string>monospace</string>
>      </edit>
>     </match>
> </fontconfig>
> ----
> 
> > $ fc-match RFont3:spacing=mono
> > DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"  
> 
> But I think that I should not need to do that manually.
> 
> 
> There is an issue about "CourierStd" which was solved by adding an
> alias from CourierStd to Courier, but which also would be solved by
> respecting the monospace flag as shown above.
> (https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/262)
> 
> 
> Should I open a bug report?
> If yes, on https://gitlab.freedesktop.org/fontconfig/fontconfig/
> or is this more a distribution problem, and I should report this to
> Debian?
> 


-- 
Regards/Mit freundlichen Grüßen
Christian Weiske

-=≡ Geeking around in the name of science since 1982 ≡=-


More information about the Fontconfig mailing list