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!


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


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/ -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:

    As a side note – at least on systems I’ve tested, Consolas looks best at 13pt size (where 12pts looks problematic and anything less is not really readable) and Inconsolata looks best at 12pt (and scales both up and down much better) – so if you prefer your fonts smaller you’d better go with Inconsolata while, at least IMO, at the best font size Consolas is slightly better then Inconsolata.

    All tests where done with anti-aliasing and full hinting – I guess FreeType’s anti-aliasing is either not as good as ClearType or simply not that compatible and Consolas was designed for ClearType with no affordance for other anti-aliasing technologies.

  2. mike:

    I found this article by accident, as a remark to Oded, you can have all the goodnes of ClearType under Linux, but this requires patching freetype, see the details on:

    With this enabled consolas looks perfectly legible at smaller sizes — almost exactly like on Windows.

  3. Dan Kegel:

    Pro tip: you don’t need wine to do the install, just use cabextract
    to extract!

    By popular demand (ok, one person asked for it), I’ve added a winetricks
    verb for this ( ).

    There are three other fonts in that cab file (CANDARA, CONSTAN, CORBEL)
    that might be of interest. Has anyone looked at them?

    • Oded:

      Thanks for the update!

      For those that are interested, here the link for how to install winetricks, which I’m more then recommending for wine users.

      Regarding the other fonts: Corbel and Candra are simple sans-serif fonts, where Candra is very simple and clean (which I like) but I don’t see any advantage to it over DejaVu Sans and friends, while Corbel is just ugly. Constantia is a relatively clean serif font which is nice to look at, but again – doesn’t have much over the competition and I don’t like serifs anyway (and its digits are way too small).

      Regarding using cabextract to circumvent the need to have wine run the installer – while easier (or at least faster – the syntax isn’t really friendly 😉 ), I believe this seriously abuses the Microsoft EULA and thus will likely not stand up to legal scrutiny. If you don’t care about this kind of stuff, and many people won’t, then by all means – go ahead and use winetricks to install Consoleas.

  4. Chris:

    I hate linux. After 3hrs of trying to simply extract & install the font, I really nearer than ever to delete the fucking ubuntu forever and start over with mac or win.

  5. Dan Kegel:

    Here’s an alternate script that doesn’t involve wine. Perhaps that would be easier for most users. (Don’t forget to do ‘sudo apt-get install cabextract’ or ‘sudo yum install cabextract’ first if you don’t have cabextract yet.)

    set -e
    set -x
    mkdir mytmp
    cd mytmp
    cabextract -L -F PowerPointViewer.exe
    cabextract -L -F ‘CONSOL*.TTF’

  6. Karancho:

    This works great! Thanks guys!

  7. Oded:

    BTW – recent versions of GNOME’s File Roller and KDE’s Ark will simply open the PowerPoint installer program as an archive. After you open the installer (which may simply be choosing “Open” in your browser when prompted what to do with the download) just double click the ``, select the font files you want and extract them to some temporary location. Then install the fonts as detailed above.

    Again, only if you seriously don’t like click through licenses 🙂

Leave a Reply to Oded



Spam prevention powered by Akismet