7

After I changed some fonts in tweaks-tool, in some programs (Slack, Chrome) font formatting for blocks of code became broken.

I tried to restore defaults, but fonts in code blocks still ugly. How it can be fixed?

Ubuntu 18.04

Example of ugly code formatting fonts in slack: Screenshot of ugly code formatting fonts render in slack

And normally should look like this: https://get.slack.help/hc/article_attachments/360003366488/inlinecode.png

3 Answers3

2

Heavily inspired by a similar resolution to a different problem, this is the simplest way to fix horrible looking code fonts in slack without having to re-install chrome or other drastic measures.

  1. Run the /slackdevtools command to open the Chrome devtools for slack (the slack interface is Chromium based)
  2. Inspect any message with a codeblock and identify the culprit font by editing the css font-family and progressively removing fonts until it fixes itself. (In my case it was Courier New making it look crap)
  3. Override the offending font with a font of your choice (or just monospace, Bitstream is just a personal favourite) by adding something like this to your ~/.fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

<fontconfig> <!-- Replace Courier with a better-looking font --> <match target="pattern" name="family"> <test name="family" qual="any"><string>Courier New</string></test> <edit name="family" mode="assign"> <string>Bitstream Vera Sans Mono</string> </edit> </match> </fontconfig>

  1. Quit and re-open slack!
1

I use Ubuntu 19.10 and ran into the same problem after making font changes using the Tweaks tool.

Do the following:

Make sure that the Fixed-Width font in chrome://settings/fonts is set to MonoSpace.

Add the file ~/.fonts.conf with the following code:

<match target="font" >
    <edit name="embeddedbitmap" mode="assign"><bool>false</bool></edit>
</match>

Uninstall chrome and reinstall chrome

1

I had the same issue, and it seems msfonts is the culprit. Firefox fonts changed after install ttf-mscorefonts

Did you install something like Visual Studio Code before your last OS restart?

I tried removing mscorefonts here How to remove ttf-mscorefonts completely?

and everything goes back to what it was.