canonical / ubuntu-pro-client

Ubuntu Pro Client for offerings from Canonical
https://canonical-ubuntu-pro-client.readthedocs-hosted.com/en/latest/
GNU General Public License v3.0
51 stars 69 forks source link

docs: ugly monospaced ligatures on my firefox #2709

Open setharnold opened 10 months ago

setharnold commented 10 months ago

Hello, my Firefox shows some very ugly monospaced ligatures on the page https://canonical-ubuntu-pro-client.readthedocs-hosted.com/en/latest/howtoguides/enable_in_dockerfile.html

I don't know quite what to blame here: that ugly thing is supplied from a font on my system, and I could probably just delete that font without crying. (I remember finding a previous instance and deleting the file in question because the package itself was required for something else.) But perhaps there's something in play here that's allowing / suggesting / encouraging this monstrosity?

Thanks

ligatures

orndorffgrant commented 10 months ago

Interesting!

We have

font-family: var(--font-stack--monospace);

and

--font-stack--monospace: Ubuntu Mono variable, Ubuntu Mono, Consolas, Monaco, Courier, monospace;

Also it is italicized as the comment

None of those result in the ff ligature on my machine :/

We don't change the default value of font-variant-ligatures which is "normal". That does allow "common-ligatures" and "contextual-alt-values" but it's weird that the font on your machine even supports them as a monospace font IMO.

Do you know what font is actually being displayed for you? You can check in firefox dev tools by inspecting element and then selecting the usually hidden fonts menu: image

setharnold commented 10 months ago

Thanks so much for investigating! The guilty fonts were Nimbus Mono PS Bold and Nimbus Mono PS Italic. I've deleted those from my system, reloaded the page, and the hateful ligatures are gone.

I've never seen that "hidden" fonts menu, thanks for sharing it.

Concretely, this fixed the monospace ligatures that smash fi and ff into a single cell:

sudo rm /usr/share/fonts/opentype/urw-base35/NimbusMonoPS*

And trying to purge that one package threatens to remove a bunch of packages that I actually use:

$ sudo apt purge fonts-urw-base35
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  cups-core-drivers cups-filters-core-drivers cups-ipp-utils evince-common fonts-droid-fallback gimp-data libamd2 libbabl-0.1-0 libcamd2 libccolamd2 libcholmod3
  libde265-0 libdjvulibre-text libdjvulibre21 libfontembed1 libgegl-0.4-0 libgegl-common libgexiv2-2 libgfortran5 libgimp2.0 libgspell-1-2 libgspell-1-common libgxps2
  libheif1 libijs-0.35 libilmbase24 libjbig2dec0 libkpathsea6 liblapack3 liblouis-data liblouis20 liblouisutdml-bin liblouisutdml-data liblouisutdml9 libmetis5
  libmypaint-1.5-1 libmypaint-common libnautilus-extension1a libopenexr24 libpoppler-cpp0v5 libpoppler-glib8 libqpdf26 libraw19 libsynctex2 libumfpack5
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  cups* cups-filters* evince* fonts-urw-base35* ghostscript* gimp* libevdocument3-4* libevview3-3* libgs9* libgs9-common* libspectre1*
0 upgraded, 0 newly installed, 11 to remove and 2 not upgraded.
After this operation, 56.7 MB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.

So I'll be content with just deleting the files and configuring dpkg to not install them again.

I don't know how I saw the ligatures and you didn't, but it's probably enough that you weren't able to reproduce it and we didn't try to achieve it.

Thanks again!

orndorffgrant commented 10 months ago

Thanks for figuring that out and sharing! So it looks like your system doesn't have the Ubuntu Mono font installed (or maybe firefox couldn't find it for some reason), so it probably fell all the way back to monospace and for some reason "Nimbus Mono PS" was chosen from your system as the default monospace font for Firefox

I'm actually going to re-open this bug though, because we should ship the Ubuntu Mono font with the docs so that the experience is consistent for all visitors. FYI @s-makin