Adding Windows Fonts in Linux

December 02, 2005
Unlike past times, Linux do come with good fonts. And the font rendering can be made better by choosing to antialiase the fonts. But at times you come across a website which has been designed with the windows user in mind. Such websites are best viewed with one of the windows fonts. If you have windows OS installed on your machine, you can copy the essential fonts from the windows partition to linux and use them to get a better web experience. Here is how you do it.
Method I :
Copy the ttf (True Type Fonts) fonts Ariel, Tahoma, Verdana, Courier New and Times New Roman from the windows partition to the fonts:// location in nautilus.

Method 2 :
Some people who are using Ubuntu have said that they can't do it as normal user. And since Ubuntu does not have a root account, they find difficulty in using su to copy eaither. Such people can do the following:
Create a '.fonts' folder in your home directory and copy the necessary fonts into it. Now you have access to the fonts on a per user basis.

Method 3:
This method can be used to install the fonts system wide if the above two methods do not give satisfactory results.
First find out in which location linux has installed the truetype fonts. It is usually at the location '/usr/share/fonts/truetype/' . But you may also do a search for the same as follows:
# find /usr -iname \*.ttf |head -n 5
Once you know the path of the fonts directory, move to this directory and create a folder there (it can be any name).
# cd /usr/share/fonts/truetype
# mkdir windowsfonts
Note: You need to be logged in as root while doing this.
Next copy all the windows ttf fonts to the windowsfonts directory that was just created.
# cp /media/hda1/windows/Fonts/*.ttf .
Now change the ownership of the fonts as well as make sure they have a right of 644 .
# chown root.root *.ttf
# chmod 644 *.ttf
Now run the command mkfontdir while in the windowsfonts directory.
# mkfontdir
This will create an index of the fonts in the directory. It will also create two files fonts.dir and fonts.cache-1 .
Now moving to the parent directory, edit the file fonts.cache-1 using your favourate editor and append the following line to it.
#File: /usr/share/fonts/truetype/fonts.cache-1
...
"windowsfonts" 0 ".dir"
Lastly run the command fc-cache.
# fc-cache
This command will scan the font directories on the system and build font information cache files for applications using fontconfig for their font handling.

That's it. Now you can have access to windows fonts in all your X applications including firefox and OpenOffice.org.

25 comments:

  • Ben

    In Debian I can "apt-get install msttcorefonts" from contrib. Is this also available in Ubuntu?

  • spiral architect

    With Mutagenix (slackware), you can slapt-get msttcorefonts from:

    SOURCE=http://mirror.datapipe.net/norlug/mutagenix/packages/

  • Will this work with the asian fonts like korean?

  • rebel

    My favourite distro Arch Linux also makes it easy as pie to install the Windows fonts: # pacman -S ttf-ms-fonts

  • "Some people who are using Ubuntu have said that they can't do it as normal user. And since Ubuntu does not have a root account"

    There is a root account, just login is disabled

    For the users in Ubuntu:
    $sudo passwd {enter}
    {type your new passwd twice}
    then
    $su -
    {enter your new password}
    Viola! root.
    #

  • Shorter version form above:

    In Terminal enter:

    sudo su -

    {after enter your password is asked, so enter password}

    Voila! Root!

  • Can somebody post a website link that uses windowz fonts so we can test this?
    Thanks.

  • I have had problems in using
    # apt-get install msttcorefonts

    in Ubuntu. Not because I was not able to install the fonts. Just that the website display got from bad to worse. But others may have had a different experience. I tried the method III and it worked without a problem. Of course, you have to have the windows fonts on your machine. More over, I think the third method is distro independent.

    Fisher.L
    Houston

  • Ubuntu users can type:

    sudo -s

    And enter their passwords rather than re-enabling the root account.

    In any case, this wiki page has more info for fonts in ubuntu:

    https://wiki.ubuntu.com/FontInstallHowto

  • sudo apt-get install msttcorefonts
    The above works perfectly in Ubuntu...

  • filosofo

    Thanks so much for the instructions. I'd been wondering how to get Bookman and Trebuchet MS on my Fedora 4 box, and Method 3 did it beautifully.

  • Thank you very much.

  • according to this faq from microsoft, you are not allowed to copy the fonts

    http://www.microsoft.com/typography/RedistributionFAQ.mspx

  • When will the Open Source community start making its own fonts and stop relying on the “generosity” of Microsoft?

  • That might be useful if you use Gnome. If you use KDE, open Control Center and under System Administration click on Font Installer. Drag and drop any fonts. Done!

  • Hello folks - I am not sure that copying fonts from a Windows system to Linux is a permitted use.

    There are plenty of legal options available to obtain some of the fonts in Windows legally. I know that Microsoft licensed http://www.ascenderfonts.com to sell them.

  • airtonix

    If your reading this and care about the way your site renders, then do not specify a font specifically. Instead use the value "sans-serif".

    Sans is latin for "without", and serifs are the lines that terminate the strokes that make up each letter.

    So all fonts are either Serif, like times new roman and palantino, or Sans-Serif like arial, Century Gothic or Helvetica.

    so if your styling any site, use serif or sans-serif after your normal font choice when specifying fonts.

    ie
    body{
    font-size:10px;
    }
    .yourCustomClass{
    font-size:1em;
    font-family:arial, helvetica, sans-serif;
    }

    This way, if a visitor does not have the first two fonts, then the browser will load the system configured sans-serif font.

    simple, now other linux people wont need to touch horrible windows reality.

  • Linux installation info for many distros (ubuntu, debian, fedora, mandriva, etc..), including search by license type (good for open source projects) at http://penguinfonts.com

  • Jim Beckner

    Hey thanks...this really helped and it worked great. This is the best fonts info I have seen...

  • Shaul

    After installing the fonts you can import a special configuration file in order to improve the look:

    wget http://www.osresources.com/files/centos-windows-fonts/fontconfig.tbz
    sudo tar xvjpf fontconfig.tbz -C /etc/fonts/
    http://ubuntuforums.org/showthread.php?t=208396

  • these fonts are legal, in exchange for microsoft releasing internet explorer in the first place.

    they are difficult to dowload usually however, as microsoft removed the direct download from their site and included them with every version of windows since '95

  • Michael

    For users that have a Windows install sitting on a drive mountable in Linux:

    Create an alias to your Windows font directory and you never have to copy/paste them:

    For example:
    ln -s [mount point] .fonts

    If your mount point is "/media/disk/" just run:

    ln -s /media/disk/ .fonts

    Restart your desktop manager and you're all set!

    You may need to edit your fstab to have the share accessible when you login.

  • to copy an paste in ubuntu as root, open nautilus as root. this is done by opening a termainal and putting in

    gksudo nautilus & exit

    then putting in user password when promted

    a nautilus window will open showing root's home folder, just navigate to /usr/share/fonts/truetype and dump all of windows fonts you have