Installing Consolas TrueType Font for Linux

This is a short “how to” article on how to get and install the new Microsoft Consolas Monotype font – this is a very nice programmer font and as described in Dan Benjamin’s “Top 10 Programming Fonts” it is highly recommended for use in your programmer’s editor or IDE (As a side note, his top selection, Inconsolata is also very nice and I highly recommend it if you don’t feel like using Microsoft created software and/or aren’t interested in performing the steps below which may or may not be legally problematic).

The main problem with using Consolas on your Linux workstation, is that this font is provided by Microsoft, and while if you are running MS-Windows (or even Mac OS-X) it may already be installed – as it is bundled with many Microsoft products, us in the Linux world have no easy (and legal) way to get to use Consolas in our code editing. Unlike Microsoft Core Fonts for the Web Consolas is not available for download – probably for the same reason the core fonts packages were pulled. But as Consolas is bundled with many Microsoft products, some are available for free download for anyone, we can use that to get us some nifty Consolas prettiness in our day to day Linux computing.

The following steps will allow you to get Consolas on your system rather easily (assuming you don’t flinch at using a terminal) and without installing any Microsoft products. I’m pretty sure its also legal to do so, even when taking into account Microsoft’s EULA, and a discussion of this is at the end if you are interested. Well, into the fray!

Requirements

you need to have the following software packages installed. If you don’t already have them installed, they are available for all Linux operating system, probably using your built-in software management UI, such as Ubuntu’s Software Center or Fedora’s Software Management.

  • Wine – the Microsoft Windows compatibility layer for Linux
  • cabextract – a Microsoft cabinet file format extractor

Procedure

After you have these installed, lets start going to the Microsoft download center and downloading the latest edition of the free PowerPoint Viewer. In the page linked, click on “Download” and download the resulting file to somewhere on your computer. The default download location for Fedora is the “Downloads” directory and for Ubuntu it is the “Desktop” directory.

Next, let’s open a terminal window (“gnome-terminal” if you are running a GNOME desktop, or “konsole” if you are running a KDE desktop), and follow these steps:

  • mkdir tmp – Create a temporary directory. The process involves creating a “wine prefix” and unpacking some files into it, and I wouldn’t want to mess up an existing wine setup if you have one.
  • cd tmp – move to the new temporary directory.
  • WINEPREFIX=$(pwd) wine ~/Downloads/PowerPointViewer.exe /extract:c:\ – ask the PowerPoint Viewer, nicely, to extract its content to what Windows call “C:” instead of installing it. Wine will setup a simulated “C: drive” inside your temporary directory and will then run the installer – you will have to read and agree to the PowerPoint Viewer EULA, but I don’t think you have anything to worry about (see the discussion below). For this command I’m assuming you’ve downloaded the PowerPoint Viewer executable to the “Downloads” directory. If this is not the case, you may change the command appropriately.
  • cabextract drive_c/ppviewer.cab -F 'CONSOLA*' – The installer has put a “Microsoft Cabinet file” into the simulated “C: drive”, that contains the files we need, so here we extract the Consolas TTF files from the cabinet.
  • rename 'y/A-Z/a-z/;s/consola/Consolas /;s/b/Bold/;s/i/Italic/;s/z/Bold Italic/;s/ ./ Regular./' *.TTF – Optional step – rename the extract files to something that a looks humanly readable. Unless you want to keep the TTF files for future use, you can skip this step.

Now you can install the new fonts – open a file browser and go to your temporary directory. Under GNOME you can install the fonts by opening the font file and the font viewer window should have an “Install Font” button at the bottom right corner. Under KDE, right click the font files and select Actions->Install… and in the dialog that opens select “Personal” to install the font only for you or “System” to install the font to all the users (this will require a system administrator password). After you complete this step for all the TTF files that were created, you can copy the files elsewhere if you want to save them as backup for when you want to reinstall your computer. Finally it is recommended to remove the temporary directory and all its content – you have no further need for this.

Legal Issues

I am not a lawyer and the following is not actually a legal argument, but lets try to look at the above procedure through the Microsoft EULA that you have to agree to in order to get the files:

It is my belief that this procedure is perfectly reasonable for personal use on any device you use – paragraph 1.a of the EULA says “You may install and use any number of copies of the software on your devices.” The rest of the paragraph immediately goes and limits the use of the software but I do no believe that its possible for a license to limit the type of use you do with a software you legally obtained (as long as that use itself is not infringing on the copyright on the software). Its like buying a car and have the manufacturer say that this car may not be used to drive on dirt roads – the manufacturer may refuse to service the car after you drive on dirt roads, but he cannot sue your for violating the “terms of use”.

Please note that after extracting the TTF files, you may not distribute the files, i.e. copy them to other people – this is strictly prohibited both under copyright law and under paragraph 1.b of the EULA, because it will not be “complete and unmodified” copies of the PowerPoint Viewer. You may, though, distribute copies of the original PowerPoint Viewer download to friends along with these instructions :-).

Regarding the legality of extracting files from the installer, the Microsoft EULA has this to say: “You may not work around any technical limitations in the software” – but we didn’t work around any technical limitations: the Microsoft software itself extracted the files for our use, so there is no technical limitation prevent us from copying files off the installer.

The PowerPoint cabinet also contains all the other fonts of the Microsoft ClearType font collection, of which only Calibri would be of any interest to users, the rest aren’t that interesting but then again – I hate serifs (interestingly all of the ClearType font collection fonts start with “C”).

Enhanced by Zemanta

11 Responses to “Installing Consolas TrueType Font for Linux”

  1. Oded:
    Fatal error: Uncaught Error: Call to undefined function comment_dir() in /vhosts/coil/geek/public_html/wp-content/themes/modern-bluish/single-comment2.php:17 Stack trace: #0 /vhosts/coil/geek/public_html/wp-content/themes/modern-bluish/functions.php(8): include() #1 /vhosts/coil/geek/public_html/wp-includes/class-walker-comment.php(179): themed_comment() #2 /vhosts/coil/geek/public_html/wp-includes/class-wp-walker.php(144): Walker_Comment->start_el() #3 /vhosts/coil/geek/public_html/wp-includes/class-walker-comment.php(139): Walker->display_element() #4 /vhosts/coil/geek/public_html/wp-includes/class-wp-walker.php(387): Walker_Comment->display_element() #5 /vhosts/coil/geek/public_html/wp-includes/comment-template.php(2229): Walker->paged_walk() #6 /vhosts/coil/geek/public_html/wp-content/themes/modern-bluish/comments.php(26): wp_list_comments() #7 /vhosts/coil/geek/public_html/wp-includes/comment-template.php(1539): require('/vhosts/coil/ge...') #8 /vhosts/coil/geek/public_html/wp-content/themes/modern-bluish/single.php( in /vhosts/coil/geek/public_html/wp-content/themes/modern-bluish/single-comment2.php on line 17