5

I had to apt-get install ttf-mscorefonts-installer on Ubuntu 12.04/12.10. The short version is I need to pipe PDF files out of an application that requires these fonts for certain glyphs.

The problem, after running this command, is that the fonts in my web browser (and some java apps) are now "ugly." Obviously this is a subjective opinion but it is the one I hold.

I want the old fonts back for most cases (Liberation, DejaVu, Ubuntu, ...). I'm not sure how best to describe this but here's an example:

Example CSS in Webbrowser

font-family: Verdana,Arial,sans-serif;

Without ttf-mscorefonts-installer (Case 1):

    $ fc-match Verdana
    LiberationSans-Regular.ttf: "Liberation Sans" "Regular"

    $ fc-match Arial
    LiberationSans-Regular.ttf: "Liberation Sans" "Regular"

    $ fc-match sans-serif
    LiberationSans-Regular.ttf: "Liberation Sans" "Regular"`

With ttf-mscorefonts-installer (Case 2):

    $ fc-match Verdana
    Verdana.ttf: "Verdana" "Normal"

    $ fc-match Arial
    Arial.ttf: "Arial" "Normal"

    $ fc-match sans-serif
    LiberationSans-Regular.ttf: "Liberation Sans" "Regular"`

I want (Case 1). Optionally, I want the fonts in (Case 2) not to look "ugly" IE. they are more jagged, less smooth than their free alternatives in my web browsers.

Is this possible?

4
  • Do you still need the 'pipe PDF files out of an application' functionality? If not, would removing the ttf-mscorefonts-installer not solve the problem? Nov 1, 2012 at 16:29
  • Yes the app I use depends on MS fonts, I need to run this app regularly. Uninstalling is not really an option.
    – conner_bw
    Nov 1, 2012 at 18:25
  • What is the app - something we can look at or a proprietary/closed source system? You can also adjust the font settings in the browser, for example in Chrome/Chromium, type chrome://chrome/settings/ into the address bar, scroll down to Show Advanced Settings, then click the Customise Fonts button in the Web content section. Nov 1, 2012 at 19:37
  • App is proprietary. Google Princexml. Try to generate hebrew.
    – conner_bw
    Nov 1, 2012 at 20:24

1 Answer 1

4

fontconfig employs a complete set of font substitution systems. There are different levels of font definition: font name and font families. Given a specific font, fontconfig uses the font of the same name if available, then seeks otherwise the font family of the same name. If there is still no match, it uses the standard font family definition as substitution, i.e. Sans, Sans-serif and Mono.

Ubuntu has the font family 'Verdana' defined in `/etc/fonts/conf.d/45-latin.conf', where 'Verdana' is set default to 'Sans-serif', which means Sans-serif is employed for 'Verdana' by default. But 'Verdana.ttf' would be used instead if it's installed.

In your system, the preferred font in the Sans-serif family is 'Liberation Sans', so fontconfig uses the 'Liberation Sans' as substitution for 'Verdana' provided there is no font of the same name, whereas uses 'Verdana.ttf' if it's in the search path. This explains what you've posted.

So the solution to your problem is that, you have to remap the font 'Verdana' to a different font, or to a group of fonts which assigns to 'Liberation Sans' the highest priority. (The latter case is recommended)

Open or create the file ~/.config/fontconfig/fonts.conf, append following:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

<match>
    <test name="family"><string>Verdana</string></test>
    <edit name="family" mode="prepend" binding="strong">
        <string>Liberation Sans</string>
        <string>Verdana</string>
    </edit>
</match>

</fontconfig>

Note that ~/.fonts.conf is deprecated now, and if you already have user-defined fonts.conf, remove the header and footer and only keep the 'match' section. And it would be too long-winded to demonstrate the same workaround on 'Arial'. I'm sure you can find it on your own.

2
  • When was ~/.fonts.conf deprecated? Does this apply to the Precise release? Nov 21, 2012 at 16:54
  • ~/.fonts.conf is deprecated due to the new version of fontconfig installed in Ubuntu 12.10. I'm not sure it has been or would be backported to 12.04.
    – funicorn
    Nov 25, 2012 at 6:27

You must log in to answer this question.

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