#981587 fontconfig prefers Bold and Oblique variants of DejaVu Sans Mono over Inconsolata or other regular monospace fonts

Package:
fontconfig
Source:
fontconfig
Description:
generic font configuration library - support binaries
Submitter:
Daniel Kahn Gillmor
Date:
2022-02-25 18:00:03 UTC
Severity:
normal
#981587#5
Date:
2021-02-01 19:59:34 UTC
From:
To:
DejaVu Sans Mono font variants "Bold" and "Oblique" don't get
appropriately pruned when the user searches fontconfig for a "monospace"
font.

if i use `fc-match --all monospace` i see all Bitstream Vera Mono font
variants come first:

0 dkg@alice:~$ fc-match --all monospace | head
VeraMono.ttf: "Bitstream Vera Sans Mono" "Roman"
VeraMoBd.ttf: "Bitstream Vera Sans Mono" "Bold"
VeraMoIt.ttf: "Bitstream Vera Sans Mono" "Oblique"
VeraMoBI.ttf: "Bitstream Vera Sans Mono" "Bold Oblique"
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
DejaVuSansMono-Bold.ttf: "DejaVu Sans Mono" "Bold"
DejaVuSansMono-Oblique.ttf: "DejaVu Sans Mono" "Oblique"
DejaVuSansMono-BoldOblique.ttf: "DejaVu Sans Mono" "Bold Oblique"
Inconsolata.otf: "Inconsolata" "Medium"
Andale_Mono.ttf: "Andale Mono" "Regular"
0 dkg@alice:~$

But while using --sort (which applies pruning) removes the "Bold" and
"Oblique" and "Bold Oblique" variants of Bitstream Vera Mono, as i'd
expect:

0 dkg@alice:~$ fc-match --sort monospace | head
VeraMono.ttf: "Bitstream Vera Sans Mono" "Roman"
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
DejaVuSansMono-Bold.ttf: "DejaVu Sans Mono" "Bold"
DejaVuSansMono-Oblique.ttf: "DejaVu Sans Mono" "Oblique"
Inconsolata.otf: "Inconsolata" "Medium"
Andale_Mono.ttf: "Andale Mono" "Regular"
Courier_New.ttf: "Courier New" "Regular"
Courier_New_Italic.ttf: "Courier New" "Italic"
n022003l.pfb: "Nimbus Mono L" "Regular"
NimbusMonoPS-Regular.otf: "Nimbus Mono PS" "Regular"

But note that above, the "Bold" and "Oblique" variants of DejaVu Sans Mono
remain unpruned (the "Bold Oblique" variant is pruned, for some reason).

I confess i don't really understand fontconfig very well, but this seems
inconsistent and problematic.  Certainly, if the standard "Book" form of
DejaVu Sans Mono was unavailable for some reason, a fallback to the
"Medium" form of Inconsolata would be better than a fallback to "Bold"
or "Oblique" DejaVu Sans Mono.

Please do to reassign this to DejaVu Sans Mono if that's the appropriate
place for the fix.