Skip to content

Instantly share code, notes, and snippets.

@sipatha
Last active September 9, 2021 20:05
Show Gist options
  • Save sipatha/2dd2f4fcf886b2db9fe869a4c06066c8 to your computer and use it in GitHub Desktop.
Save sipatha/2dd2f4fcf886b2db9fe869a4c06066c8 to your computer and use it in GitHub Desktop.
The default fonts on Ubuntu server are not the best for PDF generation. This gist installs Google & Microsoft fonts and sets a default a better default font.
# some prerequistes
sudo apt-get install -y libxrender1 libfontconfig1 libx11-dev libjpeg62 libxtst6 libglib2.0-bin -y
# only run if you want use libreoffce as well
sudo add-apt-repository ppa:libreoffice/ppa -y
sudo apt install libreoffice -y
# add restricted repositories
sudo add-apt-repository universe
sudo add-apt-repository multiverse
sudo add-apt-repository restricted
# install Microsoft fonts
sudo apt install ttf-mscorefonts-installer -y
# install Google Fonts: https://github.com/qrpike/Web-Font-Load/blob/master/install.sh
sudo bash <(curl -s https://raw.githubusercontent.com/qrpike/Web-Font-Load/master/install.sh)
# move fonts to correct directory
sudo mkdir -p /usr/share/fonts/google/
sudo cp /usr/local/share/fonts/* /usr/share/fonts/google/
# update font cache
sudo fc-cache -fv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment