Skip to content

Instantly share code, notes, and snippets.

@maxwelleite
Last active October 16, 2023 13:15
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save maxwelleite/ee5a1a4222dd43c8b4af5c99ed72b3fc to your computer and use it in GitHub Desktop.
Save maxwelleite/ee5a1a4222dd43c8b4af5c99ed72b3fc 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/Bionic
# Latest Update: 20/11/2020
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" https://source.winehq.org/git/wine.git/blob/HEAD:/fonts/tahoma.ttf
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" https://source.winehq.org/git/wine.git/blob/HEAD:/fonts/tahomabd.ttf
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
@maxwelleite
Copy link
Author

maxwelleite commented Jul 7, 2017

To execute this gist, run the line bellow in terminal:

wget https://gist.github.com/maxwelleite/ee5a1a4222dd43c8b4af5c99ed72b3fc/raw/ttf-wine-tahoma-installer.sh -q -O - | sudo bash

@Himera-Glikon
Copy link

Great Work!

@rofrol
Copy link

rofrol commented Feb 12, 2020

I don't see Tahoma font installed.

When opening link https://source.winehq.org/source/fonts/tahoma.ttf?_raw=1 I see some garbage:

<html><head><title>No LXR Page Header Warning!</title>
<base href="http://source.winehq.org:443/">
<link rel="stylesheet" type="text/css" href="templates/lxr.css">
</head>
<body>
<h4 class="warning"><p class="headline">** Warning **</p>Wide character in print at /home/winehq/opt/source/source line 927, &lt;$git&gt; line 1193.
<br></h4>
�����������@BDF \6ê��[�����EBDT�`����k8����EBLC���.���$��:�FFTM������1�����GDEF2V.1��&����GPOS��M{��+���/�GSUB��}���&�����OS/2ڣ���������`VDMXv�}V��������cmap�(~����l����cvt �D�����D����gasp������%�����glyf�,"n��$����`headc�A���L���6hhea��	��������$hmtx��/d���(���bloca���6���H����maxp�/��������� name\��F���d���Wpost�
<h4 class="warning"><p class="headline">** Warning **</p>Wide character in print at /home/winehq/opt/source/source line 927, &lt;$git&gt; line 1193.
<br></h4>
�������#?�������A흑h_�<���������|%������|%���.��
<h4 class="warning"><p class="headline">** Warning **</p>Wide character in print at /home/winehq/opt/source/source line 927, &lt;$git&gt; line 1193.
<br></h4>
�	U�������������������Y���!�.��
<h4 class="warning"><p class="headline">** Warning **</p>Wide character in print at /home/winehq/opt/source/source line 927, &lt;$git&gt; line 1193.

@maxwelleite
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment