You are on page 1of 11

12/7/2015

How to get gorgeous looking fonts on ubuntu linux

BinaryTides
HOME

APPS

CODING

DISTROS

GENERAL

LINUX

REVIEWS

SECURITY

SERVER

SUPER TIPS

How to get gorgeous looking fonts on ubuntu linux


Debian

Ubuntu

By Silver Moon

On May 17, 2013

37 Comments

Fonts on Linux
SEARCH

Fonts on linux have long been an issue due to various reasons like the BCI patent by Apple, lack of free
quality fonts etc. However over time things have changed and now its possible to get your linux system
fonts look as good as, or even better than a mac or windows 8 as far as fonts are concerned. In this post I
am going to show you couple of simple tricks that can make the fonts of your linux system look amazing!!
However first there are a couple of things to know about how the tricks work. We are mainly going to do 2
things. First is, get better fonts for the system. Second, we are going to tweak the ".fonts.conf" file in the
home directory. The ".fonts.conf" file allows a user to override the system font settings like antialiasing,
hinting, auto-hinting, sub pixel rendering etc.
The tweaks shown in the post should give identical font rendering on any linux distro provided that BCI

Connect with us

hinting (Byte code interpreter) is available (which it is on most modern linux distros since the bci patent
has now expired).

Step 1 - Get better fonts

Other interesting stuff


Install Virtualbox 4.3 on Ubuntu /
Debian / Fedora

Ok, so the first step is to get better fonts for our system. All of these fonts are free and available from the
google webfont store at the following url
http://www.google.com/fonts/
Here is a list of the fonts you shall need.

1. Droid Sans
2. Droid Sans Mono
3. Droid Serif
4. Noto Sans
5. Noto Serif

How to compile and install


wxWidgets on
Ubuntu/Debian/Linux Mint
Setup mail forwarding in postfix
on Ubuntu or Debian

Setup Apache and Php with


mod_fcgid on Ubuntu/Debian

6. Open Sans

Download the font files. Google would give all of them in a single zip file. Make sure you download all

Install and configure Apache and


php with mod fastcgi on
Ubuntu/Debian

styles and all encodings.


Once downloaded, extract them in the following directory.

Setup a mail server with Postfix


and Dovecot on Ubuntu / Debian

/usr/share/fonts

And they would get installed.

Step 2 - Tweak your .fonts.conf


The next step is to tweak the font rendering through the .fonts.conf file. This file exists in your home
directory. In newer versions of ubuntu, if this file is not already there, then create one. The file is in xml
format, and through its syntax we can define various settings on per font basis. Like replace a font by
another, use autohinting for a certain font, don't use for another and so on.
So copy the xml from the following url to your .fonts.conf file
https://gist.github.com/silv3rm00n/5599072
If you already have a fonts.conf file then take a backup first. Later if you decide to revert,
Make sure you installed the fonts mentioned in the previous step. After this you need to configure few font
settings in kde/gnome, firefox and google chrome. Move on to the next section or continue reading to
know more about the fonts.conf tweaks.

Some background
The ubuntu wiki page on fonts has a font configuration xml provided by Obi Bok. It focuses on getting
windows xp style clear looking fonts on your linux system with microsoft fonts. For this you need to install
the microsoft fonts like Arial, Verdana, Tahoma, Georgia, Times New Roman etc.
On Ubuntu the fonts are available in the repository by the package name ttf-mscorefonts-installer. By
installing those fonts, and putting the xml setting in your fonts.conf file your fonts should look like that of
windows xp. Infact they would look better than windows XP.
Those microsoft fonts might work well for you, but I think they are out dated and its time to get some
http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/

1/11

12/7/2015

How to get gorgeous looking fonts on ubuntu linux

modern fonts.
So I modified the original fonts.conf by Obi Bok to suit more to Droid, Noto and Open Sans font families.
You will see the results in a short while.

Step 3 - Configure font settings


Now we shall be configuring the desktop (KDE or GNOME) and the web (Firefox or Chrome) to get better
font renderings according to our plan.

Configure system fonts - KDE


On KDE, launch System Settings, go to "Common Appearance and Behaviour > Application appearance >
Fonts".
Select "Droid Sans" size 9 for all fonts. For "fixed width" font select "Droid Sans Mono" size 9.

In "Use anti-aliasing" dropdown, select "System Settings". Leave force font dpi unchecked.
On KDE the subpixel rendering cannot be enabled from the .fonts.conf file. Adding the following will have
no effect
Hence it has to enabled from the Font settings box.

The subpixel rendering setting for kde is stored in the file "~/.kde/share/config/kdeglobals" in a field
named "XftSubPixel=rgb".
Thats it. That should make your fonts look better. Try logging out and relogin, if the settings don't take
effect properly.

http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/

2/11

12/7/2015

How to get gorgeous looking fonts on ubuntu linux

Gnome
The newer gnome desktops dont have a direct option to change the fonts. Use a tool like gnome-tweaktool and change the fonts.
Gnome with the default Ubuntu Font at size 11pt.

Gnome with tweaked Droid Fonts at size 10pt.

http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/

3/11

12/7/2015

How to get gorgeous looking fonts on ubuntu linux

Configure web fonts - Chrome/Firefox


Now open the browsers google chrome and firefox and go to font settings area. And use the following
settings
Standard Font - Sans
Serif Font - Serif
Sans-serif font - Sans
Fixed-width font - monospace
Minimum font-size - 11px

Chrome

Firefox

That much is enough for configuring the browsers.

Final Results
The dialog boxes shown above already show the final rendering of the fonts on the desktop. Now I am
putting up some screenshots of how the fonts look on webpages.
Here is quick comparison between our font tweaked google chrome on linux and Google chrome with
default fonts on windows 8.

Ubuntu default - Chrome


On a fresh installation of Ubuntu 12.10, google chrome shows google.com like this
http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/

4/11

12/7/2015

How to get gorgeous looking fonts on ubuntu linux

Ubuntu TWEAKED - Chrome


Here is the same result with our font tweaks applied. The fonts look rich and well fed.

Windows 8 - Chrome
And for some comparison take a look at how Windows 8 looks

It should be easy to spot out right away how rich the fonts on ubuntu look, when compared to windows 8. I
have not checked with mac. May be you should try that and let me know the results.

Monospace
For monospace we have 2 great choices. Droid Sans Mono and Inconsolata. However each has got issues.
1. Droid Sans Mono does not have a Bold version. So making them bold looks ugly on webpages.
Inconsolata has got a bold version.
2. Inconsolata is smaller in size than Droid Sans Mono. So at the same size of 9pt or 12px Inconsolata looks
much tinier than Droid Sans.
3. Comparatively Droid Mono is clearer than Inconsolata.
Here is a screenshot of how each looks on KDE with full hinting.
Droid Mono at 9pt

http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/

5/11

12/7/2015

How to get gorgeous looking fonts on ubuntu linux

Inconsolata at 10pt

So Inconsolata at 10pt looks like Droid Mono at 9pt. Also note that Droid Mono looks nicer than
Inconsolata.
Both are at full hinting with autohinting disabled.

Droid Mono vs Ubuntu Mono


Droid Mono at 9.5pt in Konsole/KDE with full hinting

Ubuntu Mono at 11pt in Konsole/KDE with slight hinting

http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/

6/11

12/7/2015

How to get gorgeous looking fonts on ubuntu linux

What tweaks have been done


Now I shall explain the tweaks done to your font settings.
1. Arial, Tahoma, Verdana has been replaced by 'Noto Sans'. This will affect the webpages.
Those 3 fonts are used a lot on websites, because most websites are still living in the old age. So we
replace them with Noto Sans, a modern and beautiful looking font from Google.
2. Georgia, Times New Roman replaced by Noto Serif. This will also affect the webpages.
Same reason as before, Noto Serif looks very good.
3. Droid Sans is made the default sans and sans-serif font. This is used on desktop and also on webpages
as fallbacks.
4. Droid Serif is made the default serif font.
5. Droid Sans Mono is the default monospace font. This will be seen in the terminals and code editors.

Different fonts for desktop and web


It is important to note that we are using the Droid fonts for the desktop and the Noto fonts for the web
(through replacement trick). We could have used the same droid fonts on the web too but it would not
work very well for a couple of reasons.
1. To make Droid fonts look the best on the desktop we use bci hinting (by disabling autohinting). Due to
this the fonts look very good, but there is a tradeoff. At size 12px ( which is very common on websites )
the font look tiny. Using such a tiny font on a webpage hinders readability.
2. With auto hinter, the size would go up but rendering quality is hampered on the desktop.
3. On web pages Noto Sans with autohinter looks more clear compared to bci hinter, but slightly stretched
compared to bci.
So to get the best looks on both the desktop and the web, I came up with the solution of using Droid on
the desktop with BCI hinting, and Noto on the web with autohinter.

So do these tweaks matter


The tweaks shown above were tested on LCD monitor at 96 dpi (not sure if that was the actual dpi of the
monitor).
On laptops fonts perform better, so even if you were to use a less nicer or a little bad looking font, it would
look good on laptops/pads where the pixel density is higher.
Moreover if you are using gnome, then your fonts are by default 11pt which is bigger than the 9pt/10pt
examples shown above. At big sizes fonts again perform better. Thats the reason the Ubuntu fonts look
good enough on gnome. At smaller sizes the performance or the clarity becomes more testable.
That was the desktop part. On webpages fonts come in various sizes and 12px and 13px are the most
common. So this is the place that needs most of the beautification. So even if you are content with the
gnome desktop with ubuntu font, the web fonts are surely not very upto the mark, as already shown
above.
So try out the tweaks and suggest me further improvements. I hope to continue developing the .fonts.conf
file to tweak and tweak more the font settings to achieve don't know what. Have fun till then!!

Additional Notes
Google Chrome is buggy when it comes to following the rules mentioned in the .fonts.conf file. It does not
obey the pixelsize rules. This does not matter unless you want to tweak the fonts.conf file yourself. Firefox
follows the rules very well.
In browsers, the fonts.conf hinting rules might not be followed if the actual fonts are not available on the
http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/

7/11

12/7/2015

How to get gorgeous looking fonts on ubuntu linux

system but present on the webpage through css3. In that case the default hinting rules would be followed.
On chrome, if the fonts are present on the system then fonts.conf rules shall be applied.
On firefox if fonts are loaded via css3 then the fonts.conf rules shall not be applied and default antialiasing
will be applied always. However if the same fonts are not loading by css3, then the fonts.conf rules shall
be applied.

References
This is a very old and probably the first article that ever came up talking about font issues on linux and
how to get windows like fonts on various linux distros.
http://avi.alkalay.net/linux/docs/font-howto/Font.html
This is an excellent article that explains various fonts.conf settings like antialiasing, bci hinting, auto
hinting. Its a must read.
https://wiki.archlinux.org/index.php/Font_Configuration
The syntax of the .fonts.conf file is explained here
http://linux.die.net/man/5/fonts-conf
The original xml on which my tweaks are based can be found here
https://wiki.ubuntu.com/Fonts
Last Updated On : 8th January 2014

Subscribe to get updates delivered to your inbox

Enteremailtosubscribe

Subscribe

No related posts.

About Silver Moon


Php developer, blogger and Linux enthusiast. He can be reached at
admin@binarytides.com. Or find him on Google+

37Comments

BinaryTides

Share

Recommend

Login

SortbyBest

Jointhediscussion
NoonianAtall 2yearsago

Lookslikeyouturneduphintingorthatfileyoulinkedtowithoutexplainingdoeswhichisonlysubjectively
better.Manypeoplethinkitmakestextlookworse(e.g.OSXdoesn'tuseit).Ican'tstandsinglepixelwide
fonts,andthat'swhathintingforcesatsmallersizes.Basically,Ithinkyour"before"shotslookbetterthanyour
"after"ones.
15

Reply Share

torriem 3yearsago

Evenwithstandardfonts,myfontsonLinuxhavelookedgreatforthelastfewyears.Ialwaysturnonsubpixel
renderinganddisableallhinting.That'stheclosestIcangettoOSX'sfontrendering.DefinitelytheDroid
fontslooksuperb.ThoughIdisagreewithreplacinganyandallseriffonts.AtdecentresolutionsSeriffonts
areeasiertoreadthansansserif,especiallyforlongblurbssuchasnewsarticlesorbooks.There'sareason
Romanfontshavebeeninuseforthousandsofyears!Perhapsinthefuturewe'lllookbackonthistimeof
proliferationofsansseriffontsandseeitasabriefperiodwhenwehadtousesansseriffontsbecausewe
didn'thavegoodenoughscreens.
2

Reply Share

SilverMoon Mod >torriem 3yearsago

Wearenotreplacingseriffontsbysansserif.
OnlytheGeorgiaandTimesNewRomanfontsarereplacedbyNotoSerif,whichisalsoaseriffont
thatlooksmuchbetter.

Reply Share

AlexeyMorozov 2yearsago

IwonderhowyoudidmanagetogetsubpixelfontrenderinginPlasmaappletsandpanels,Inmostplaces
(e.ginthepanelclocksandintheKmenuIhavegrayscalerenderingdespitethesystemsettingsandfont
renderinginapplications.
1

Reply Share

The111 2yearsago

Thanksfortheexcellentguide.Iamhappywithisforthemostpart,withafewverysmallexceptions.One
thatirksmealotisthatexclamationmarksarenearlyundistinguishablefromlowercaseL's.Anyideashowto
improvethat?
1

Reply Share

LeonardoRossi>The111 ayearago
http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/

8/11

12/7/2015

How to get gorgeous looking fonts on ubuntu linux

HiMatt,Ihavethesameissuewithexclamationmarks(minearelookinglikeaJactually).
Haveyoumanagedtosolvethis?
1

Reply Share

srikkbhat 8monthsago

DoesthisworkonFedora21?

Reply Share

SimonPeres 10monthsago

Wowthisisgreat.Worksonmysamsungandvaiolaptops.anw,Iusekubuntuforboth.updatedversionof
xml.fonts.confwillbetrulyappreciated

Reply Share

VctorQuirsVargas ayearago

Hi,itlooksliketheimagesforthisarticlearegoneandIremembertheycontainpreciousinformationonthe
configurationsteps.Isitpossibletohavethemallback?Thanks!

Reply Share

Whatfor? ayearago

IsuggestFantasqueSansMonoformonospace.http://openfontlibrary.org/en/...

Reply Share

Arun ayearago

InfinalityisanotherwaytogetthebestfontrenderingonUbuntu.Italsoallowstotweakmanymoreoptions:
http://tuxdiary.com/2014/09/27...

Reply Share

A.Nonymous ayearago

*"...LCDmonitorat96dpi(notsureifthatwastheactualdpiofthemonitor)..."*
DPI"calculator":
https://www.sven.de/dpi/
PerhapsonemayalsofindthatithelpstosetthecorrectDPIviaxrandrorxorg.conf.
Itusedtobecorrectlydetectedinearlierxorgversions,butitwasdecidedthatitshouldbebugcompatible
withWindows(atleastpre7/8),andhaveahardcodeddefaultsettingof96dpi,ratherthanviaconfiguration,
regardlessofanything.
Dependingonyourresolution,usingthecorrectDPImaymakethingshavewrongsizesthough(orsomewhat
blurredfontsiftheactualDPIissmaller,Iguess),that'sbecausesomeoftheUIsarehardcodedtohave
pixelbasedsizesratherthanactualmeasurementssize.Hopefullythiswillchangesoon,itseemsalmost
unavoidablewiththetrendofresponsivewebdesign.

Reply Share

Kevin 2yearsago

Thanksalot,butIstillhavedifficultiesintweakingfontforChromiumbrowseronUbuntu14.04.Thebrowser
couldnotdisplaywell,however,Firefoxisfine.

Reply Share

Tom 2yearsago

IdidallthesetweaksonElementaryOSandnowmyloginscreen(PantheonGreeter)haswhiteboxeswhere
charactersshouldbe...Afterloginthefontsappearfine,however.AnyoneknowhowIcanfixthis?

Reply Share

A.Nonymous>Tom ayearago

I'mnotreallysure,butI"often"seewhiteboxesinplaceofcharactersthatdon'texistonagivenfont,
likeAsiancharacters,ifIdon'thavethefontinstalled.Perhapsit'ssomethinglikethatthatis
happening,somehow.

Reply Share

DaveGahan 2yearsago

Thanksforthispost!greatfontsbutIhaveaproblemwithchromiumifImusingOpenSansorNotoSansthe
URLbar'stextbecomesjumpyasifItdoesnt'fit,anysimilarbehavior?

Reply Share

augustuswong 2yearsago

whataboutlatoptmonoptsansptserifongooglewebfonts

Reply Share

Al 2yearsago

Hi,
IinstalledUbuntu13.10andtriedtofollowthismanual,butwhenImodify.fonts.confIreceivesquareblocks
insteadofletters,althoughImadeallprevioussteps.WhatshouldIdotomakeeverythingworksproperly?
Thanks!

Reply Share

Falopius 2yearsago

Absolutelyawesome,theonlythingthatdidn'tfellgoodformeonUbuntuwasthelackofgoodsharplooking
fontsonmydesktop.Thisworkedlikeacharm

Reply Share

Lance 2yearsago

Thanks,ThisworkedwellwithslighttweeksforLinuxMinut15Cinnamonandlooksgreat.Ialsoappliedthe
FirefoxsettingstoThunderbirdandvastlyimprovedreadabilityofemailimo.
CinnamonFontsMenu>SystemTools>SystemSettings>Fonts

http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/

9/11

12/7/2015

How to get gorgeous looking fonts on ubuntu linux

CinnamonFontsMenu>SystemTools>SystemSettings>Fonts
DefaultFontDroidSans9
DocumentFontDroidSans9
MonospaceFontDroidSansMono9
WindowTitleFontDroidSans9
Hinting:Slight

Reply Share

AllanNienhuis 2yearsago

Iwasgettinganumberoferrors/warningsintheconsolewhenlaunchingbinariesinubuntu13.04usingthe
configfilelinkedinthegistabove:
Havingmultiplevaluesin<test>isn'tsupportedandmaynotworkasexpected
Isimply(andnaively)duplicatedthetestconditionforeachofthechildentries.Thisseemedtoavoidtheerror
messagesandthefontsseemstostillrendernicelysoIdon't_think_Ibrokeanything.Butasmentionedthis
wasareallynaivechangesoyourmileagemayvary.gisthere:https://gist.github.com/allann...

Reply Share

DavidLatapie 2yearsago

Youmightappreciatemyarticleaboutyourwork:http://david.latapie.name/blog...

Reply Share

Guest>DavidLatapie 2yearsago

It'snotbetter.It'stotallydifferent.Seethescreenshotsonyourblog,ontherightside"Images""I"has
aserif,theleftsideissansserif.ReplacingorsubstitutingtypefacesisNOTbetterthancorrectly
rendering,asInfinalitydoes.IrecommendInfinalityoverthismethod.Muchbetter.Really.

Reply Share

doa 2yearsago

Isthereawaytomakethetypefacesappearmorebolder/heavier?

Reply Share

OlivierDony 2yearsago

Withthelatestfontconfigversionyourfonts.conffilegenerateslotsofwarnings:"Havingmultiplevaluesin
<test>isn'tsupportedandmaynotworkasexpected".Iforkedyourgisttofixtheminwhatseemstobethe
expectedwayThoughtyoumightwanttohavealookandupdateyours.https://gist.github.com/odony/...

Reply Share

Johannes 2yearsago

Thanks,however,thereisoneproblemIamhaving:Withthis.fonts.conf,renderingofmostPDFfilesin
Firefox'/Iceweasel'sinternalPDFviewerisverymuchmessedup.Forsomereason,itdisplayshuge,
overlappingletters,makingthepagecompletelyunreadable.Ihavealreadycommentedoutsomesectionsof
the.fonts.conf,butsofartonoavail.Anyhint,whichsectionmightbetoblame?

Reply Share

SilverMoon Mod >Johannes 2yearsago

theinbuiltpdfvieweroffirefoxdoeshaveitsownfontrenderingissues.
Notsurewhichfonts.confsettingismessingitup.Maybeyoucantrytoavoidthereplacementofarial
bynotosans.

Reply Share

Johannes>SilverMoon 2yearsago

Ihavetrackedtheproblemdowntolines517519ofthe.fonts.conf.IfIcommentthemout,the
viewerworksjustfine.Thelinesinquestiongo
<editname="autohint"mode="assign">
<bool>true</bool><\!\>
</edit>

Reply Share

SilverMoon Mod >Johannes 2yearsago

Soyouhadtodisableautohintingforthefont'BookAntiqua'

Reply Share

rsking84>SilverMoon 2yearsago

Johannes,
Thatfixdoesn'tworkonmyinstall.NotethatI'musingOliverDony'sforkedversionof
fonts.conftoavoidthe"multiplevalues"warnings.Anyway,ifIdisableautohintingfor
BookAntiquaIstillhavetherenderingproblemsinFirefox.Anyotherideas?

Reply Share

anonBrian 3yearsago

InthelastcoupleofmonthsI'vereplaceDroidmonowithInconsolatait'smynewfavoritemonospacefont.I
useitinkonsole/yakuake,andinallmytexteditors/IDEs.http://www.google.com/fonts/sp...

Reply Share

SilverMoon Mod >anonBrian 3yearsago

Icompareddroidmonowithinconsolata,andfoundthatdroidmonoperformsbetterintermsofclarity
andniceness.HoweverDroidMonodoesnothaveaboldversionwithinconsolatahas.Thisisa
drawbackfordroidmonowhenusedonwebpages,whereboldversionslookbadwithwhatever
hinting.
Addedscreenshotsofbothfontsinthepost.

Reply Share

PopeRonPolypII>SilverMoon 3yearsago
http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/

10/11

12/7/2015

PopeRonPolypII>SilverMoon 3yearsago

How to get gorgeous looking fonts on ubuntu linux

MyprimarycomplaintwithDroidMonoisthatitisrelativelydifficulttodistinguishbetween"0"
and"O".
2

Reply Share

Anonymous 3yearsago

HelloSilverMoon,
thanksfortheniceread.
Oneadvisethough.Whilesubpixelsmoothingcanlookgreatshouldoneturnitoffforcreatingscreenshots.
Noteveryone'sdisplayuseslefttorightRGBorderinganditwillthencreatecolourfringesaroundlettersfor
thosewithadifferentordering.Turnoffsubpixelsmoothingandonlyusegreyscalecolourstomakeyour
screenshots"websafe".

Reply Share

SilverMoon Mod >Anonymous 3yearsago

Thanksforthesuggestion,butIwonder,aren'tmostdisplaydeviceslikelcdmonitors,laptopsand
padsusing"lefttoright"rgbbasedpixeldisplay?

Reply Share

jon_downfromthetrees 3yearsago

ThescreengrabsfromUbuntulookgreat.Aretheresultsequivalentonsystemsthatdon'thaveUbuntu'sfont
renderingpatches?

Reply Share

SilverMoon Mod >jon_downfromthetrees 3yearsago

Therenderingpatchesarenotspecifictoubuntu.ItsthebcisupportinFreetypefontengine.
TheBCIpatentsarenowexpired,soitisavailableonallmajorlinuxdistros.
SotheresultsshouldbeidenticalonalllinuxsystemsthathaveBCIenabled.

Subscribe

Reply Share

AddDisqustoyoursite

Privacy

About us

Contact us

Faq

Advertise

Privacy Policy

Copyright 2015 BinaryTides

http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/

11/11

You might also like