Package: ttf-bitstream-vera Version: 1.10-8.1 Control: affects -1 chromium fontconfig python-matplotlib-data src:fonts-dejavu
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://dkg.fifthhorseman.net/table.txt
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:
If I remove ttf-bitstream-vera from the system, then Chromium renders the text with DejaVu Sans Mono instead, yielding a correct view:
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-matplotlib-data, gravit-data, and the ~20 other
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-extra?) could Provide:
ttf-bitstream-vera, since it appears to provide aliases for Bitstream
Vera in e.g. /etc/fonts/conf.avail/57-dejavu-sans-mono.conf -- i
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"
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"
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/share/fonts/truetype/ttf-bitstream-vera/VeraMono.ttf
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/share/fonts/truetype/dejavu/DejaVuSansMono.ttf
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
signature.asc
Description: PGP signature

