Ever since I have FreeBSD 12 installed on a spare laptop, I notice that this is the most frequently used portable machine at home. (Of course, I still use my main desktop, which runs Fedoda 27, for everything.) I think one of the main reasons is that I like the experiences when I started using Linux years ago – not everything works out of the box, and sometimes I’m forced to learn and understand better about an issue before it can be fixed.

So today, I managed to fix another font rendering issue of the source code viewer on Github on Firefox. Here’s how it looks like before the fix:

Everyone’s guess must be some fonts used on Github to display the source code must be unavailable on my system. But which font? According to a page on Quora [1], the code is displayed in the first font available on my system:

  1. Consolas

  2. Liberation Mono

  3. Courier

  4. monospace

So one way to fix this is to try to install one of those listed font above. Another solution which I have yet to verify is to update the fonts.conf (usually resides in ~/.config/fontconfig directory) to include the substitute of the missing fonts with available one. Anyway, I went with the 3rd solution which is to install a font called Liberation from Red Hat. This fonts are to replace Microsoft TTF fonts. I came across this font name while viewing a Youtube video[2].

# pkg search liberation
liberation-fonts-ttf-2.00.1,2  Liberation fonts from Red Hat to replace MS TTF fonts
# pkg install liberation-fonts-ttf
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 4 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	liberation-fonts-ttf: 2.00.1,2
	mkfontscale: 1.1.2
	libfontenc: 1.1.3_1
	mkfontdir: 1.0.7

Number of packages to be installed: 4

The process will require 4 MiB more space.
1 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching liberation-fonts-ttf-2.00.1,2.txz: 100%    1 MiB 158.7kB/s    00:09

Then without even restarting Firefox, I just refreshed the Github page with F5. Here’s what I see now:

That’s it. All I need to do now is to figure out how to crop the images screenshot on FreeBSD using i3-gaps as the window manager.

References:

[1] What font and theme does GitHub use in its code viewer? [2] After a Minimal Linux Install: Graphical Environment and Users