how to download, install and use google web fonts in linux
Google Fonts has several hundreds of open source fonts that are optimized for web use. Even though they are designed to be used in web pages, it can still be used as a desktop font. In order to use any font as a desktop font, you will need to install it on your system.
To use any of the fonts from Google, you will need to download it first and then go through the process of installing it locally on your system. The Google Fonts uses a format called WOFF that is not exactly compatible with desktops, which means you will need to convert it to a compatible format.
WOFF format
Web Open Font Format or WOFF is a font format that was designed to work optimally on webpages across many, if not all web browsers. It is essentially a TrueType or OpenType font that has added capabilities such as compression and meta data support. This allow it to be easily transferred between machines, especially from web servers to client machines with minimum bandwidth usage.
Download Google Fonts
- Go to Google Fonts website
- Select the fonts that you want and add that to the collection.
- Click on Use to see the code
- In the third section under the tag marked Standard, you will find the link tag that can be used on a website. Copy the link or URL that is in the tag for the href attribute. This will look something like :
http://fonts.googleapis.com/css?family=Ubuntu+Mono|Montez|Gafata|Lusitana
- Paste that URL in to a browser window and you will see the CSS code displayed.
- Copy the URL that is shown in the url(…) part of the code. That will be something like this:
src: local('Gafata'), local('Gafata-Regular'), url(http://themes.googleusercontent.com/static/fonts/gafata/v3/1_IZAK3uvysA0G_ed1qSXA.woff) format('woff');
- Paste that URL in another browser window and you will be able to download the woff file for the font you wanted.
- Save this file locally on your machine
Convert WOFF to TIFF format
One of the most commonly used font format in desktops is the Tiff format. There are a couple of different ways you can convert a woff format into a tiff format. You can either use one of the many online converters that are available, or install a font converter tool locally on the system.
A simple search on the web will give you many options to perform this conversion task online. Some of the popular online converters are everythingfonts, convertfonts or Online Font Converter.
One easy to use command line utility that you can install and use is woff2otf. If you plan to use font converters regularly, then a software like FontForge might be useful.
Once you have converted the woff to the tiff format using any of the tools, you can proceed with installing it on your system.
Installation
Most distros give you an user interface to install and modify fonts. It is quite possible that the desktop environment that you are using also have an interface. Many times, if the file associations on your system is set correctly, you can just double-click on the ttf file which will open and install the font in a supported program.
In KDE, you can use the System Settings and then click on Font Management under the System Administration section. In Gnome, gnome-font-viewer can be used to view and install fonts. You can also install the fonts manually from the command line.
To install manually, copy the font file (.tiff) into the folder /usr/share/fonts/truetype/custom. If you donot have access to this folder, you can copy them to ~.fonts/ folder in your home directory. After you have copied the file, you can refresh the font cache to load them.
bash$ sudo fc-cache -fv
The font should now be available for you to use, just as any other font currently installed on the system.
In addition to the command line options described in this post, you also have the option of installing a software that will download and install fonts. One of the softwares that allow you to do this is TypeCatcher. TypeCatcher gives you several features such as previewing, searching and installing the fonts at the click of the button. If you are not comfortable using the command line, then this software is a good alternative.