Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubensa/306bb083a734940987e744b15d15c84a to your computer and use it in GitHub Desktop.
Save rubensa/306bb083a734940987e744b15d15c84a to your computer and use it in GitHub Desktop.
Script to install the latest Wine Tahoma fonts on Ubuntu distros
#!/bin/bash
# Author: Maxwel Leite
# Website: http://needforbits.wordpress.com/
# Description: Script to install the latest Wine Tahoma Regular and Wine Tahoma Bold fonts on Ubuntu distros from the Wine Project.
# The Wine project includes the free and open-source fonts Wine Tahoma Regular and Wine Tahoma Bold released under LGPL
# designed to have identical metrics to the Microsoft Tahoma font. This was done because Tahoma is available by default
# on Windows, and many applications expect the font to be available.
# Dependencies: wget
# Tested: Ubuntu Saucy/Trusty/Xenial
output_dir="/usr/share/fonts/truetype/msttcorefonts/"
tmp_dir="/tmp/ttf-wine-tahoma-installer"
if [[ $EUID -ne 0 ]]; then
echo -e "You must be a root user!\nTry: sudo ./ttf-wine-tahoma-installer.sh" 2>&1
exit 1
fi
if ! which wget >/dev/null; then
echo "Error: wget is required to download the file"
echo "Run the following command to install it:"
echo "sudo apt-get install wget"
exit 1
fi
file1="$tmp_dir/tahoma.ttf"
file2="$tmp_dir/tahomabd.ttf"
mkdir -p "$tmp_dir"
cd "$tmp_dir"
err=0
echo -e "\n:: Downloading Tahoma Regular from Wine Project...\n"
wget -O "$file1" http://source.winehq.org/source/fonts/tahoma.ttf?_raw=1
if [ $? -ne 0 ]; then
rm -f "$file1"
echo -e "\nError: Download Tahoma Regular failed!?\n"
err=1
else
echo -e "Done!\n"
fi
echo -e "\n:: Downloading Tahoma Bold from Wine Project...\n"
wget -O "$file2" http://source.winehq.org/source/fonts/tahomabd.ttf?_raw=1
if [ $? -ne 0 ]; then
rm -f "$file2"
echo -e "\nError: Download Tahoma Bold failed!?\n"
err=1
else
echo -e "Done!\n"
fi
if [ $err -ne 1 ]; then
echo -n ":: Installing... "
mkdir -p "$output_dir"
cp -f "$tmp_dir"/*.ttf "$output_dir" &> /dev/null
if [ $? -ne 0 ]; then
echo "Error: Can't copy files to output directory."
err=1
else
echo "Done!"
fi
fi
if [ $err -ne 1 ]; then
echo -n ":: Clean the font cache... "
fc-cache -f "$output_dir" &> /dev/null
echo "Done!"
fi
echo -n ":: Cleanup... "
cd - &> /dev/null
rm -rf "$tmp_dir" &> /dev/null
echo "Done!"
if [ $err -ne 1 ]; then
echo -e "\nCongratulations! Installation of ttf-wine-tahoma-installer is successful!!\n"
else
echo -e "\nSome error occurred! Please try again!!\n"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment