// How to change Fedora's font rendering to get an Ubuntu-like result [Update]

Font rendering is a matter of taste. However, I personally think Ubuntu's default font rendering is the most eye-pleasing one of the whole Linux eco-system. And if a website's CSS font stack is looking good on Ubuntu, you can be relatively sure that it also works for Mac or MS Windows as long as the used fonts are available on these platforms. It is not hard to get the same font rendering on Fedora. This text is just a bit longer than a few commands because I try to provide additional background information and useful web-search-keywords which you may need if you have other targets than a 100% Ubuntu-like rendering.

The basics

To achieve the desired result, you have to know which parameters exist and how to change them. The most important things are:

  • Resolution (DPI).
  • Font hinting and the used font hinting method.
  • Font rasterization. Especially the used anti-aliasing method and its strength.
  • The used font rendering engine. The one shipped with Fedora comes without subpixel rendering (more on this later).

So let's look at the defaults applied on Ubuntu 10.10. You can do this on the terminal with xrdb -query:

Xft.dpi:	96
Xft.antialias:	1
Xft.hinting:	1
Xft.hintstyle:	hintslight
Xft.rgba:	rgb
Xft.lcdfilter:	lcddefault

As you can see, Ubuntu is using RGB anti-aliasing with subpixel rendering (lcd-default means “subpixel (LCD)” method) and slight font hinting. Now compare this with the default values on Fedora 15 Lovelock:

Xft.antialias:	1
Xft.dpi:	96
Xft.hinting:	1
Xft.hintstyle:	hintmedium
Xft.rgba:	none

This shows that Fedora does use grayscale anti-aliasing, a stronger font hinting style and no subpixel rendering by default. This is the reason why the same fonts look different on Fedora and Ubuntu.

What to do

  1. Install the freetype-freeworld package. You need subpixel rendering the achieve the same results as on Ubuntu. The FreeType rendering engine shipped by default comes without it but you can install the freetype-freeworld package out of the RMPfusion-free repository to get a version with subpixel rendering. If not already happend, enable RPM Fusion on your system. Open a terminal and install the freetype-freeworld package:
    su -c "yum install freetype-freeworld"

    You should know that subpixel rendering is patented and therefore not completely free (as in speech). Using this package might not be legal in your country. The choice is yours and it is your legal responsibility to make sure that the software you are installing can be legally used.

  2. Adjust the hinting style and enable RGB anti-aliasing. Ubuntu it using hintslight hinting by default, Fedora comes with hintmedium. Additionally, we need RGB instead of grayscale anti-aliasing. Open a terminal and execute the following commands to set the anti-aliasing and hinting style:
    gsettings "set" "org.gnome.settings-daemon.plugins.xsettings" "hinting" "slight"
    gsettings "set" "org.gnome.settings-daemon.plugins.xsettings" "antialiasing" "rgba"
  3. Activate the lcddefault lcdfilter. Unfortunately, there is no GSettings key for it (at least as I'm writing this), therefore you have to create a hidden .Xresource file with the Xft.lcdfilter: lcddefault setting in your home directory. Open a terminal and execute the following command to do so:
    echo "Xft.lcdfilter: lcddefault" > ~/.Xresources
  4. Some settings need a restart to take effect, so reboot your system. If everything worked you should get the following xrdb -query output (the output order does not matter if the values are the same):
    Xft.antialias:	1
    Xft.dpi:	96
    Xft.hinting:	1
    Xft.hintstyle:	hintslight
    Xft.lcdfilter:	lcddefault
    Xft.rgba:	rgb

Additional notes

  • You may find the gnome-tweak-tool interesting. E.g. it provides an option to switch the window-title-bar font. Use the following command to install it:
    su -c "yum install gnome-tweak-tool"
  • I used the command line tool gsettings to adjust the GSettings key values above. If you want to influence and explore available keys by using a GUI, have a look at the dconf-editor. Use the following command to install it:
    su -c "yum install dconf-editor"
  • You may want to use the Ubuntu fonts, too. They are not included in the main repositories right now,1) therefore I wrote the install-ubuntufonts-fedora.sh bash script to make the font installation faster and easier. There is a high probability that this script will never be useful to someone else than myself. But you never know. If you want to use it, open a terminal and run the following commands to download and execute it (copy and paste recommended):
    wget "http://blog.andreas-haerter.com/_export/code/2011/07/18/install-ubuntufonts-fedora.sh?codeblock=1" -O "/tmp/install-ubuntufonts-fedora.sh"
    chmod a+rx "/tmp/install-ubuntufonts-fedora.sh"
    su -c "/tmp/install-ubuntufonts-fedora.sh"

    Please read the Ubuntu Font Licence for all the rules that govern the use of the fonts.

  • If you want to go any further, you should know some things about the fontconfig system. First of all, it is controlled by *.conf files. Fedora is looking for them at the /etc/fonts/conf.d/ directory and they get imported in alphabetical order.2) Please note that every file in this directory should be a symlink pointing to a real config file located in /etc/fonts/conf.avail/. This makes it possible to deactivate settings by deleting the symlink in /etc/fonts/conf.d/ without loosing the corresponding config file in /etc/fonts/conf.avail/. It is also recommended to follow the rule “one setting, one file”. This makes sure you always know which files configures what.
    All settings at /etc/fonts/conf.d/ are affecting all user accounts and therefore you need root privileges to create or edit the files. If you want to influence only a specific user account, it is also possible to place files in the user's ~/.fontconfig/ directory (simply create it if it is not already existing).
  • I assume that your display is using RGB pixels (the subpixel layout test page can help you to verify this). If your monitor is using BGR, V-RGB, or V-BGR pixels, you might want to use another anti-aliasing setting than rgba.

Screenshots

Edit 2011-07-21: Here are the demanded screenshots. You can use your keyboard to navigate trough them ( and key). The last one shows a terminal with Ubuntu fonts.

1) There is only a ubuntu-title-fonts package which does not install the normal Ubuntu font
2) Numerical prefixes are used to adjust the import order. See /etc/fonts/conf.d/README for details

Comments

Pieter
No. 1 @ 2011/07/19 00:22

Hi Andreas. Thanks for this posting. I'll definitely be trying it out with F15 on my laptop. On my main workstation I still have F14. Do you know which steps are required for F14? Thanks!

No. 2 @ 2011/07/19 01:07

@Pieter: Mhh, I directly switched over to Fedora 15 (coming from Ubuntu). That is why I never had a running Fedora 14. But everything should be the same there except the way hinting and antialiasing is set because we got GNOME 2 instead of GNOME 3. Therefore I assume that the following works:

  1. Install the freetype-freeworld package as described above.
  2. Adjust the hinting style, enable RGB anti-aliasing with the following commands:
    gconftool-2 --type "string" --set "/desktop/gnome/font_rendering/antialiasing" "rgba"
    gconftool-2 --type "string" --set "/desktop/gnome/font_rendering/hinting" "slight"
    gconftool-2 --type "string" --set "/desktop/gnome/font_rendering/rgba_order" "rgb"

    If you want to use a GUI to explore possible values, use gconf-editor.

  3. Reboot and check the xrdb -query output. Activate the lcddefault lcdfilter as descibed above if needed.
Leif
No. 3 @ 2011/07/19 02:12

Before and after screenshots would be interesting. I've never been particularly picky about fonts, but I'm curious what the fuss is about.

bochecha
No. 4 @ 2011/07/19 06:41

+! to Leif's suggestion, screeshots would be great. :)

bochecha
No. 5 @ 2011/07/19 10:10

@bochecha: That was supposed to be a +1.

Damn you US qwerty keyboard!

nim
No. 6 @ 2011/07/19 10:25

Instead of writing a script to install ubuntu fonts, why don't you package them into Fedora ?

No. 7 @ 2011/07/20 16:21

@nim: Well, because I am new to the Fedora community and simply don't know how to create/submit packages right now (formalities, technology…) . But I definitely work myself in ASAP. If there is no Ubuntu fonts package until then, this would be a nice first package to create. :-)

@Leif: I will add some screenshots ASAP.

nim
No. 8 @ 2011/07/20 17:06

http://fonts.fedoraproject.org/

Troshlyak
No. 9 @ 2011/07/20 22:36

Maybe it kinda offtopic - but when it comes to font rendering “madness” the only package that was able to satisfy my tastes is the ones from infinality - http://www.infinality.net/blog/. IMHO the patches are way better than current freetype-freeworld and produce much better results compared to OSX and Windows 7 (yes, I do believe that :-) ), not to mention all the tweaks that are avaialble througn config files …

[…] How to change Fedora’s font rendering to get an Ubuntu-like result […]

Ave
No. 11 @ 2011/07/21 00:39

Thanks a lot for this insightful, well-written tutorial. I'm new to Fedora, and I found your guide very helpful.

The only slight problem I've now to overcome is that Fedora's fonts in Firefox still seem a little washed out compared to MS Windows. A high contrast of black on white using windows appears to me like a dark gray on white using Fedora.

Do you have any thoughts on how I might attempt to make black text more “black”?

Regards

No. 12 @ 2011/07/21 18:20

@Leif: Here they are.

@nim: Thanks. I'll try join the fonts team / work myself in ASAP.

@Ave: Well, I would experiment with the hinting style (hintslight vs. hintsmedium vs. hintsfull) and check if you really got a RGB monitor. Additionally, give yourself 2-3 days to become accustomed to a new font rendering. Especially if you had a pixelated rendering until now, hinted fonts on Mac OS X or Linux seem to look “unsharp” although the opposite is the case. But you will soon notice that your eyes won't become tired when reading much text… and big font sizes eg (40pt on a website) are good-looking instead of being a bunch of pixels.
BTW: Which windows do you you mean? XP? Seven?

No. 13 @ 2011/07/21 22:52

Sorry, but I fail to see the improvement. I understand this is a bit subjective and depends a lot on viewing distance, but for me the change is from medium sharp fonts to very smooth-looking fonts, however blurry, less “solid” (I don't know how to express it better, but even though the fonts look thicker, they look less black) and with colourful halo (and yes, I've double checked that I have the RGB settings correct).

In short, as far as me is concerned, best settings are the stock fedora freetype package and full hinting and I still see some room for improvement here and there.

No. 14 @ 2011/07/21 23:25

@Martin:

Sorry, but I fail to see the improvement.

E.g. look at the headline of the Wikipedia-Screenshots (it is blatantly obvious there). The default is not “sharp” or “solid”, it is just pixelated: stock fedora settings vs. modified as described above.

But if you are happy with your settings, everything is just fine. As I already said, everybody should choose a rendering he is happy with. I wrote this How-To because I love the Ubuntu-rendering style. And I know this is also true for others. Even most Mac users I know can life with this rendering even though they usually dislike the way fonts look on other systems because Mac OS renders fonts more accurately than most other systems by default.

However: this shall be no “mine is better than yours” blog posting. It is just a help for others who got the same needs as myself. Nothing more, nothing less. :-)

No. 15 @ 2011/07/21 23:45

@Andreas Haerter: Oh, yes, I was a little bit unfair here: the big bold font looks better “after”, the rest is better the “before” way, for me at least. I also noticed that with freetype-freeworld it tends to get better at bigger sizes or for light grey on black background (terminal). But I should add that my personal preference is in both cases for full hinting, the other two settings feel too blurry for me (especially horizontal strokes). Maybe if I find some time (and will) I'll blog myself about the font settings, and it will be a picture based blog post, but no promises. It's actually not the first time I tried to play with font settings :-D

Pieter
No. 16 @ 2011/07/22 23:06

@Andreas Haerter: thanks for the instructions! I will give them a try.

Tenton
No. 17 @ 2011/07/23 01:01

Thank you for this post. This font issue plagued me for years. Now it is resolved.


[…] here […]

Pieter
No. 19 @ 2011/07/25 19:23

@Andreas Haerter: Hi Andreas, I tried your instructions on F14 and fonts look much better now. Thanks!

One question remains. In your instructions above for Fedora 15 (F15) it says I need to install the freetype-freeworld RPM from rpmfusion. Afaik the freetype-freeworld RPM in rpmfusion and freetype RPM in F15 now offer the same functionality because the Fedora freetype RPM also has the bytecode interpreter enabled (see bug #547532 on bugzilla.redhat.com where that is mentioned).

So why do I need to install the freetype-freeworld RPM from rpmfusion if it does the same as the one in stock Fedora 15?

Should you want to have a look for yourself, you can get the freetype source package (SRPM) here: http://koji.fedoraproject.org

yuri
No. 20 @ 2011/08/21 17:24

thank you for your post trying to switch to fedora 15 from ubuntu, it's sad to see so bad looking fonts from the box in fedora

Chema Martin
No. 22 @ 2011/08/27 18:59

Great post, thanks!!

I haven't had the time to go through these instructions in detail, but I think they are meant for Fedora GNOME. Can the same effect be achieved in KDE? (I assume so, because PCLinuxOS makes it happen, but I would like to understand how!)

Thanks

No. 23 @ 2011/08/27 19:13

@Chema Martin: Well, I don't use KDE for my machines. However the following should work (but I have not tried it by myself): follow the described steps but try to adjust the hinting style and enable RGB anti-aliasing by using the KDE GUI instead of GNOME's gsettings. The KDE menu “System Settings→Apperance” should do the trick.

Harry
No. 24 @ 2011/10/28 00:30

Thanks so much for the info, I just migrated from Ubuntu and hate the default font rendering in Fedora 15. Your tutorial is really helpful. But I have a question, I installed tweak tool before I found your tutorial but the result is not as expected because there's no menu to change the rendering to LCD Default. So now if I set something like font size or type in the tweak tool, do you think it will overwrite the current (like in your tutorial) rendering settings? Thanks.

No. 25 @ 2011/11/02 02:00

@Harry: The tweak tool switches are just a GUI for the mentioned gsettings commands. Therefore the GNOME tweak tool does not overwrite the settings, it just changes them in the same way gsettings does it. Regarding lcddefault: just read “3. Activate the lcddefault lcdfilter” and follow the instructions. Hope that helps. :-)

Gere
No. 26 @ 2011/11/17 15:45

Thanks for this. you rock!

Plop
No. 27 @ 2011/11/23 14:45

Very cool article. Any plan to upgrade those instructions to Fedora 16?

No. 28 @ 2011/11/23 21:19

@Plop: Haven't tried it on Fedora 16 (I plan to upgrade within the next days) but it should work there the same way?! What is the problem?

Plop
No. 29 @ 2011/11/24 12:52

@Andreas Haerter: No problem whatsoever, I didn't try anything yet. I'm in the middle of a work intensive period and don't really want to take the chance of breaking my display, so I wanted to make sure everything was compatible with F16 before tinkering my config files ;)

Plop
No. 30 @ 2011/11/25 00:11

For what it's worth, on my screen, with Fedora 16, it seems that freetype-freeworld doesn't do anything particular. The rgba rendering it exactly the same than with the default freetype.

Furthermore, I don't see any difference with or without the “lcddefault lcdfilter.” What is it supposed to do exactly?

By the way, if those 2 things above aren't relevant anymore on Fedora 16, gnome-tweak-tool alone might do the trick. After all, you can use it to configure font hinting as well as antialiasing ;)

Plop
No. 31 @ 2011/11/25 00:23

Guess this may be why… : http://www.linuxjournal.com/content/prettier-fonts-way

Wieland Gmeiner
No. 32 @ 2011/11/27 00:04

Thanks a lot, just fixed the fonts on my new Fedora 16 with KDE as you suggested.

No. 33 @ 2011/12/09 07:05

Thanks very much! It works well on fedora 14.

No. 34 @ 2011/12/09 16:36

[…] Andreas Haerter posted a blog post on how to properly tweak font settings. […]

Arjuna
No. 35 @ 2012/01/05 19:35

Very good tip @Andreas Haerter. I just did the following on Fedora 16:-

Xft.antialias: 1

Xft.dpi: 96

Xft.hinting: 1

Xft.hintstyle: hintslight

Xft.lcdfilter: lcddefault

Xft.rgba: rgb

Fonts look great now. Thank You.

Peter
No. 36 @ 2012/01/07 23:53

Thanks for this! Worked like a charm on my Fedora 16 install.

Neil
No. 37 @ 2012/01/11 10:46

Thanks very much for posting this. The main reason I haven't stuck with Fedora in the past is because I didn't like the font rendering, but now they definitely look as good as Ubuntu's.

Brilliant.

No. 38 @ 2012/01/26 03:20

[…] 2011:07:18:tune-improve-fedora-fonts-typeface-ubuntu-like-sharp … […]

Juanzelli
No. 39 @ 2012/02/07 02:53

@Neil: +1

No. 40 @ 2012/02/08 10:25

Really nice, Very cool sharing… Thanks

Det
No. 41 @ 2012/03/15 12:24

Juhuu! After upgrading from F14 to F16 I was about to throw everything out of the window. Now, I can read the screen again. Thanks a lot!

Tim
No. 42 @ 2012/03/28 01:15

Thanks so much for sharing this! It really improves Fedora a whole lot. They ought to include this in the distribution because I can't see why anyone with an LCD monitor wouldn't want to have this.

Bernd
No. 43 @ 2012/04/02 21:14

Thanks a lot - I usually work on Windows 7 and the fonts looked much better on it than on Fedora 16. This improved it a little bit (and some of my eye strain I tend to get since switching to Fedora) but it still seems a litte bit 'fuzzy'.

Umitoz
No. 44 @ 2012/04/05 20:40

Useful post! I am mostly using Ubuntu, but currently I am running Fedora 16, and the only glitch was the font issue. Now it is solved, thanks a lot.

No. 45 @ 2012/04/29 17:49

@Andreas Haerter: There's no Ubuntu fonts package.

No. 46 @ 2012/04/30 01:54

Ignore what I said..

No. 47 @ 2012/04/30 01:59

Fedora user can download the Ubuntu font from here.

centos
No. 48 @ 2012/11/16 16:16

hi, thanks a lot for this. It is not working on centos 6.3 though. Any idea why?

centos
No. 49 @ 2012/11/16 16:16

hi, thanks a lot for this. It is not working on centos 6.3 though. Any idea why?

No. 50 @ 2012/11/29 18:45

Finally get rgba antialiasing working according this article, I thought it was a bug, now I know I need install freetype-freeworld package which is not provided by official Fedora repository.

Jeff
No. 51 @ 2013/09/15 01:39

Great post! Just switched to Fedora (testing it anyways) and the fonts in Firefox were driving me nuts.

But what is most interesting is you solved a mystery for me. You see for years I have used Arch Linux and to get good fonts I would first install the Ubuntu patched rendering libraries and then uninstall it. The reason I un-installed it was because I just liked the way it looked once I did that. And I knew that by first installing it that I was getting something that didn't get un-installed but I could not figure out what that was. It must have been something to do with the subpixel rendering libraies.

I love how you could prove out on the command line what was happening :).

No. 52 @ 2013/10/25 09:29

Thanks for the detail instructions. Just for information, these instructions are still well valid on Fedora 19 in Year 2013. My only complain about fedora was bad fonts and now its resolved. I'm now very happy on Fedora!

Leave a comment…




LHTBU
  • E-Mail address will not be published.
  • Formatting:
    //italic//  __underlined__
    **bold**  ''preformatted''
  • Links:
    [[http://example.com]]
    [[http://example.com|Link Text]]
  • Quotation:
    > This is a quote. Don't forget the space in front of the text: "> "
  • Code:
    <code>This is unspecific source code</code>
    <code [lang]>This is specifc [lang] code</code>
    <code php><?php echo 'example'; ?></code>
    Available: html, css, javascript, bash, cpp, …
  • Lists:
    Indent your text by two spaces and use a * for
    each unordered list item or a - for ordered ones.
I'm no native speaker (English)
Please let me know if you find any errors (I want to improve my English skills). Thank you!
Recent Comments
QR Code: URL of current page
QR Code: URL of current page 2011:07:18:tune-improve-fedora-fonts-typeface-ubuntu-like-sharp-fonts (generated for current page)