Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
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? –  Clive van Hilten Nov 1 '12 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 '12 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. –  Clive van Hilten Nov 1 '12 at 19:37
    
App is proprietary. Google Princexml. Try to generate hebrew. –  conner_bw Nov 1 '12 at 20:24

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
When was ~/.fonts.conf deprecated? Does this apply to the Precise release? –  Jonah Bishop Nov 21 '12 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 '12 at 6:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.