fontconfig should prefer DejaVu over Bitstream Vera
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
fontconfig (Debian) |
New
|
Undecided
|
|||
fontconfig (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Imported from Debian bug http://
Message part #1
Package: ttf-bitstream-vera
Version: 1.10-8.1
Control: affects -1 chromium fontconfig python-
Textual tables drawn with standard UTF-8 box drawing characters
(U+2500…U+25FF) are being mis-rendered by Chromium in a common default
configuration.
https:/
ships a text/plain; charset=UTF-8 file contains a simple textual table
for testing:
╒═
│ This is a Table │ It contains text │ Implemented with │
╞═
│ Unicode │ Box drawing │ Characters │
└─
It is mis-rendered by default on chromium on systems that have Bitstream
Vera Mono installed, like so:
Message part #2
[inline image 'bitstream-
Message part #3
If I remove ttf-bitstream-vera from the system, then Chromium renders
the text with DejaVu Sans Mono instead, yielding a correct view:
Message part #4
[inline image 'dejavu-
Message part #5
I think what's happening is that Chromium selects Vera Sans through
fontconfig, and then when it discovers missing glyphs, it falls back to
rendering those glyphs in some other font, which does not have the same
width as Vera Sans. This results in mis-rendered tables that use
unicode box drawing.
Possible Solutions
------------------
I see a few different possible fixes, in different places:
- Bitstream Vera Mono could implement monospaced glyphs for the unicode
box drawing characters
- fontconfig could prefer more complete fonts when searching for a
match, which would prioritize dejavu sans (or some other more
complete font) over bitstream vera
- fontconfig could manually prefer DejaVu Sans Mono over Bitstream Vera
Mono when given the search string "monospace"
- chromium, when substituting missing glyphs in a monospace font, could
ensure that the substitute glyphs are appropriately sized for the
font they are filling in for.
- chromium could hardcode (and depend on?) a preferred monospace font
by default that is more complete than Bistream Vera as its default
monospace font
- We could drop ttf-bitstream-vera from the archive, which would affect
packages like python-
packages that Depend on ttf-bitstream-vera directly. I can't afford
to just purge the package from my system because i need matplotlib :(
- fonts-dejavu-core (or fonts-dejavu-
ttf-
Vera in e.g. /etc/fonts/
don't know whether this is sufficient for all the explicit
Dependencies of ttf-bitstream-vera, though.
Diagnosis
---------
Chromium's default monospace font appears to rely on fontconfig for
selection.
In particular, i think it sends font-config the "monospace" search term,
which when Bitstream Vera is installed results in:
0 dkg@alice:~$ fc-match monospace
VeraMono.ttf: "Bitstream Vera Sans Mono" "Roman"
0 dkg@alice:~$
Without bitstream-vera installed, it looks like fontconfig will prefer
dejavu sans mono, which contains these glyphs and doesn't break the
rendering:
0 dkg@alice:~$ fc-match --sort monospace | head
VeraMono.ttf: "Bitstream Vera Sans Mono" "Roman"
DejaVuSansM
DejaVuSansM
DejaVuSansM
Inconsolata
Andale_
Courier_
Courier_
n022003l.pfb: "Nimbus Mono L" "Regular"
NimbusMonoP
0 dkg@alice:~$
To verify my suspicion about font replacement characters, i used
"fontimage" from the fontforge package to render the files in question
explicitly:
I tried rendering the table using fontimage with the two fonts:
fontimage -o veramono.png --pixelsize 10 \
--text '╒═════
--text '│ This is a Table │ It contains text │ Implemented with │' \
--text '╞═════
--text '│ Unicode │ Box drawing │ Characters │' \
--text '└─────
/usr/
Message part #6
[inline image 'veramono.png']
Message part #7
fontimage -o dejavusansmono.png --pixelsize 10 \
--text '╒═════
--text '│ This is a Table │ It contains text │ Implemented with │' \
--text '╞═════
--text '│ Unicode │ Box drawing │ Characters │' \
--text '└─────
/usr/
Message part #8
[inline image 'dejavusansmono
Message part #9
My takeaway from these two images is that Vera Mono doesn't have the
box drawing glyphs at all, but DejaVu Sans Mono does have them.
----
I recognize that this report is likely to be difficult for debian to
handle as there are so many different packages that are involved. I've
initially assigned it to ttf-bitstream-vera, but if the maintainers of
that package think that the best solution lies outside of that package,
i hope they'll re-assign it appropriately.
Regards,
--dkg
Imported from Debian bug http:// bugs.debian. org/981577