58

Fonts look bad and blurry in Ubuntu. When I compare a site in Ubuntu and Windows the Windows font look much more readable even after I import all of my Windows fonts. How can I change this?

5
  • 7
    Ubuntu users who prefer Windows-style fonts may find my answer at this Super User question useful: superuser.com/questions/19824/better-ubuntu-fonts
    – Jonik
    Aug 7, 2010 at 10:24
  • Very nice answer. Aug 17, 2010 at 14:43
  • 2
    @Jonik, make that comment an answer so we can vote on it! Sep 6, 2010 at 19:32
  • @Jorge: Done, it's right here now.
    – Jonik
    Sep 7, 2010 at 22:01
  • Just add the MS Fonts. I have always preferred them, particularly for Word documents and other cross-platform content. (See Pascal's or yeeeev's responses below.)
    – david6
    Dec 24, 2011 at 10:00

10 Answers 10

59

When you say “make fonts look good”, you really mean “make fonts look like I'm used to” - if you were coming from a Mac you'd be asking “how do I prevent my fonts being distorted”.

Font rendering in Windows is heavily aligned to the pixel grid, trading sharp edges for distorted fonts. This corresponds to the “full hinting” option in Appearance→Fonts→Details. You shouldn't have to touch any further configuration.

Font rendering on OS X is the other way around - it does not distort the font shapes, meaning that most glyphs span a pixel boundary. This corresponds to the “none” hinting option.

By default, Ubuntu is somewhere in between - using slight hinting which distorts the fonts a bit to make them fit the pixel-grid better.

If you're using an LCD display you should have subpixel antialiasing enabled, regardless of the hinting type.

2
  • Very nice! Looks very good now. Aug 5, 2010 at 18:33
  • "you really mean make fonts look like I'm used to" > Yeah, sure because GNOME/Linux/Ubuntu have usable font rendering for sure. This is one of those areas where things always have been broken under Linux and people simply ignore it and try to pin it to "user preference". Both Windows and macOS have decent solutions to font rendering, while Linux in generally shows up a blur that contributes to eye strain.
    – TCB13
    Jul 5, 2023 at 11:20
33

Ubuntu users who prefer Windows-style fonts may find this answer that I posted to a Super User question called "Better Ubuntu Fonts" useful.

Here is an example of what you can expect if you follow my advice:

1
  • 1
    I posted this as an answer as suggested by Jorge Castro. I don't like duplicating information none too much, so I'm just pointing to the Super User post instead of copying all of it here...
    – Jonik
    May 25, 2011 at 15:06
14
  1. Enable font hinting.

    Right click the desktop, click change background, click the font tab and turn on subpixel smoothing. You might find you get better results through the detail button.

  2. If your fonts are "broken" in some applications as mine were a while back in Firefox, try this:

    sudo fc-cache -fv
    

    It should just refresh your system font-cache. Looks silly but it worked for me.

1
  • 1
    It looks a tad better. It's still not perfect with Windows. Aug 5, 2010 at 0:21
6

In May 2010 patents related to TrueType hinting expired,before that FreeType used Autohinting which made non-hinted fonts look better but made professional and fully hinted fonts look crap.

Since patents related to font hinting have expired FreeType has enabled font hinting by default,you can upgrade to maverick or use the latest version of FreeType for best results.

4

What I think really helped out my font smoothness was from adjusting the dpi.

First, open a terminal and type:

xdpyinfo | grep resolution

It'll give you a number like "96x96".

Now go to the Fonts tab in the Appearance settings. Click the details button in the bottom right corner. At the top of this new window it has a place to put a number. Put the first number that terminal command gave you. For example, it gave me "108x106" so I put 108 there.

Doing this will get you closer to those smooth fonts you're looking for.

2

I've used Ubuntu for 4 years now, but i still prefer "windows like" font rendering. You are not alone...

1- install msttcorefonts :

sudo apt-get install msttcorefonts

2- add tahoma truetype fonts to /usr/share/fonts/truetype/ from some old Windows disk (that's a shame, I know ;-)

sudo cp --no-preserve=all somewhere/Tahoma*.ttf /usr/share/fonts/truetype

3- save the following fonts.conf in /etc/fonts/conf.avail with some name like 39-clearfonts.conf (with root ownership)

sudo cp --no-preserve=all ~/Download/fonts.conf /etc/fonts/conf.avail/39-clearfonts.conf

4- create a symlink in /etc/fonts/fonts.d

sudo ln -s /etc/fonts/conf.avail/39-clearfonts.conf /etc/fonts/conf.d

5- in appearence settings, in fonts tab, select "Sans" with size 10, regular or bold, as font for anythings except serif font (the last one) and validate.

You should get something like your are waiting for ! (sorry, as a new user here, i'm not allowed to post screenshot)

Here is the magic fonts.conf file :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

<fontconfig>
    <!--     Default fonts for generic families      -->
    <alias>
        <family>fantasy</family>
        <prefer>
            <family>Comic Sans MS</family>
            <family>URW</family>
        </prefer>
    </alias>
    <alias>
        <family>monospace</family>
        <prefer>
            <family>Courier New</family>
            <family>DejaVu Sans Mono</family>
        </prefer>
    </alias>
    <alias>
        <family>sans-serif</family>
        <prefer>
            <family>Tahoma</family>
            <family>Arial</family>
            <family>DejaVu Sans Condensed</family>
        </prefer>
    </alias>
    <alias>
        <family>serif</family>
        <prefer>
            <family>Times New Roman</family>
            <family>DejaVu Serif Condensed</family>
        </prefer>
    </alias>
    <!--     Alias for common fonts in case they're not found        -->
    <alias>
        <family>Arial</family>
        <accept><family>sans-serif</family></accept>
    </alias>
    <alias>
        <family>Bitstream Vera Sans Mono</family>
        <prefer>
            <family>Courier New</family>
            <family>DejaVu Sans Mono</family>
        </prefer>
    </alias>
    <alias>
        <family>Comic Sans MS</family>
        <accept><family>URW</family></accept>
    </alias>
    <alias>
        <family>Courier</family>
        <prefer><family>monospace</family></prefer>
    </alias>
    <alias>
        <family>Courier New</family>
        <accept><family>monospace</family></accept>
    </alias>
    <alias>
        <family>cursive</family>
        <accept><family>URW</family></accept>
    </alias>
    <alias>
        <family>Georgia</family>
        <accept><family>serif</family></accept>
    </alias>
    <alias>
        <family>Garamond</family>
        <accept><family>serif</family></accept>
    </alias>
    <alias>
        <family>Helvetica</family>
        <default><family>sans-serif</family></default>
    </alias>
    <alias>
        <family>Impact</family>
        <accept><family>sans-serif</family></accept>
    </alias>
    <alias>
        <family>Palatino Linotype</family>
        <accept><family>serif</family></accept>
    </alias>
    <alias>
        <family>Trebuchet MS</family>
        <accept><family>sans-serif</family></accept>
    </alias>
    <alias>
        <family>Tahoma</family>
        <accept><family>sans-serif</family></accept>
    </alias>
    <alias>
        <family>Times</family>
        <prefer><family>Times New Roman</family></prefer>
        <default><family>serif</family></default>
    </alias>
    <alias>
        <family>Times New Roman</family>
        <prefer><family>Times New Roman</family></prefer>
    </alias>
    <alias>
        <family>Verdana</family>
        <accept><family>sans-serif</family></accept>
    </alias>
    <!--     Bitstream Vera Sans is default for sans-serif. Replace it with something nicer      -->
    <alias>
        <family>Bitstream Vera Sans</family>
        <prefer>
            <family>Tahoma</family>
            <family>Arial</family>
            <family>DejaVu Sans Condensed</family>
        </prefer>
    </alias>

    <!--     Bitstream Vera Serif is default for serif. Replace it with something nicer      -->

    <alias>
        <family>Bitstream Vera Serif</family>
        <prefer>
            <family>Times New Roman</family>
            <family>DejaVu Serif Condensed</family>
        </prefer>
    </alias>
    <!-- Replace Helvetica with Arial, to be tested with fc-match helvetica -->
    <match target="pattern">
        <test qual="any" name="family">
        <string>Helvetica</string>
        </test>
        <edit name="family" mode="assign" binding="strong">
        <string>Arial</string>
        </edit>
    </match>   
    <match target="font">
        <edit mode="assign" name="rgba"><const>rgb</const></edit>
    </match>
    <match target="font">
        <edit mode="assign" name="hinting"><bool>true</bool></edit>
    </match>
    <match target="font">
        <edit mode="assign" name="hintstyle"><const>hintmedium</const></edit>
    </match>
    <match target="font">
        <edit mode="assign" name="antialias"><bool>true</bool></edit>
    </match>
    <match target="font">
        <test compare="more_eq" name="size" qual="any" target="default"><double>-1</double></test>
        <test compare="less_eq" name="size" qual="any" target="default"><double>15</double></test>
        <test name="family">
            <string>Arial</string>
            <string>Comic Sans</string>
            <string>Courier New</string>
            <string>Georgia</string>
            <string>Impact</string>
            <string>Helvetica</string>
            <string>Lucida Bright</string>
            <string>Lucida Console</string>
            <string>Lucida Sans</string>
            <string>Microsoft Sans</string>
            <string>Palatino Linotype</string>
            <string>Tahoma</string>
            <string>Ubuntu</string>
            <string>Times New Roman</string>
            <string>Trebuchet MS</string>
            <string>Verdana</string>
        </test>
        <edit mode="assign" name="antialias"><bool>false</bool></edit>
    </match>
    <match target="font">
        <test compare="less_eq" name="pixelsize" qual="any" target="default"><double>20</double></test>
        <test name="family">
            <string>Arial</string>
            <string>Comic Sans</string>
            <string>Courier New</string>
            <string>Georgia</string>
            <string>Impact</string>
            <string>Helvetica</string>
            <string>Lucida Bright</string>
            <string>Lucida Console</string>
            <string>Lucida Sans</string>
            <string>Microsoft Sans</string>
            <string>Palatino Linotype</string>
            <string>Tahoma</string>
            <string>Ubuntu</string>
            <string>Times New Roman</string>
            <string>Trebuchet MS</string>
            <string>Verdana</string>
        </test>  
        <edit mode="assign" name="antialias"><bool>false</bool></edit>
    </match>
</fontconfig>
2

There are two main places where you can set the rendering of your fonts and at first sight they don't appear to have anything to do with each other:

gnome-appearance-properties shows you settings which apply to all GTK apps and allows you to choose various levels of smoothness and hinting. The settings here apply to all fonts equally. Other font settings such as the decision whether to hint or to autohint are taken from the following:

fonconfig is the program that is in charge of font configuration and font matching across the system. You make your choices by editing /etc/fonts/local.conf (~/.fonts.conf per-user) or by making symbolic links in /etc/fonts/conf.d to various presets in /etc/fonts/conf.avail. The technical details can be read by running man fonts.conf. Firefox and Chromium read their settings directly from here, only consulting gnome-appearance-properties if no hinting settings are found at all.

In my .fonts.conf I have four sections:

  1. Whether each font is autohinted or hinted normally. To use autohinting explicitly, set hinting to true and autohinting to true. I have autohinting at slight for most fonts except for newer "expensive" fonts and MS fonts, which get hinted normally at medium. Exceptions are DejaVu Sans Condensed, Lucida Grande, PT Sans, Segoe and Tahoma which are hinted slightly. I think the Windows style is normal hinting at full/medium (which are typically the same). The freetype documentation says that autohinting will be applied if no truetype hinting information is supplied with the font and that seems to apply in Firefox too. Take care that the .fonts.conf doesn't conflict with the presets.

  2. The substitutions and fallbacks that apply if a font is not found on the system. I swap DejaVu Sans Condensed for Tahoma, DejaVu Sans for Geneva, Arimo for Arial, Mukti Narrow for Lucida Grande and FreeSans for Helvetica.

  3. Exceptions. For example, autohinting is turned off for bold fonts.

  4. Aliases for the standard names; sans-serif, serif, monospace, cursive and fantasy.

Once you have written your .fonts.conf, open Wikipedia and by choosing your default proportional font to be sans-serif in Preferences > Content > Advanced you can quickly see how each font looks by using the arrow keys on the Default Font as shown in the picture.

Firefox Font Preferences

Alternatively, Igor's blog has a test page where you can compare all the different rendering options side by side for a particular font.

1

Tom at Tombuntu has some tips for enhanced font rendering (this is from 2008, so the instructions might not be exact any longer):

Your first stop is the GNOME’s configuration settings for fonts, located in System->Preferences->Appearance under the Fonts tab. If you’re using an LCD display make sure you have the subpixel smoothing rendering mode enabled. Click Details to get access to the hinting options. Play around with these to get a result you like.

Here’s a sample of my system’s fonts configured with these settings:

image1

There are many more options for font rendering available with a .fonts.conf file. This file, from this forum post, turns on a hinting feature that is usually disabled due to patent issues with Apple.

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="font">
    <edit name="autohint" mode="assign">
      <bool>true</bool>
    </edit>
  </match>
</fontconfig>

Copy and paste the text above into a text file, and save it in your home directory as .fonts.conf (note the first period, this file will be hidden). Log out for the changes to take effect. Here’s a sample of fonts with this file:

image2

A more complex .fonts.conf file (source), produces very smooth and bold fonts similar to those in OS X. Here’s a sample:

image3

2
  • That last download doesn't exist any more on that site. Do you have another link by chance?
    – Seth
    Apr 29, 2013 at 0:35
  • @Seth I've updated the link.
    – ændrük
    Apr 30, 2013 at 17:56
0

Unity doesn't have such font settings like KDE. For those who wants to implement @Jonik's solution but uses Unity.

.fonts.conf

    <?xml version="1.0" ?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <fontconfig>
        <match target="font">
            <edit name="antialias" mode="assign">
                <bool>false</bool>
            </edit>
            <edit name="rgba" mode="assign">
                <const>rgb</const>
            </edit>
            <edit name="hinting" mode="assign">
                <bool>true</bool>
            </edit>
            <edit name="autohint" mode="assign">
                <bool>true</bool>
            </edit>
            <edit name="hintstyle" mode="assign">
                <const>hintmedium</const>
            </edit>
            <edit mode="assign" name="lcdfilter">
                <const>lcddefault</const>
            </edit>
        </match>

        <match target="font" >
            <test name="size" qual="any" compare="more">
                <double>11</double>
            </test>
            <edit name="antialias" mode="assign">
                <bool>true</bool>
            </edit>
        </match>

        <match target="font" >
            <test name="pixelsize" qual="any" compare="more">
                <double>15</double>
            </test>
            <edit name="antialias" mode="assign">
                <bool>true</bool>
            </edit>
        </match>

        <match target="font" >
            <test name="size" qual="any" compare="less">
                <double>9</double>
            </test>
            <edit name="antialias" mode="assign">
                <bool>true</bool>
            </edit>
        </match>

        <match target="font" >
            <test name="pixelsize" qual="any" compare="less">
                <double>12</double>
            </test>
            <edit name="antialias" mode="assign">
                <bool>true</bool>
            </edit>
        </match>
    </fontconfig>
-3

Microsoft core fonts can also be installed from command line using:

sudo apt-get install msttcorefonts
1
  • I already have the fonts. Aug 5, 2010 at 13:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .