13

I have the Microsoft C-Fonts installed, and they're wonderful. However, Calibri appears as a bitmap font in a lot of the sizes that it appears. How do I tell fontconfig to forbid Calibri (and Cambria,etc.) from being rendered from the embedded bitmaps? I already have 70-no-bitmaps.conf in my /etc/fonts/conf.d/ directory.

The fonts in question can be extracted from the PowerPoint Viewer.

2
  • AFAIK those fonts aren't freely distributable? (So I can't test them.) But are you sure they use bitmaps, and don't just disable antialiassing?
    – JanC
    Commented Jan 11, 2011 at 19:33
  • @JanC The fonts do indeed use prerendered bitmaps. Commented Jan 29, 2011 at 6:57

2 Answers 2

21

/etc/fonts/conf.d/70-no-bitmaps.conf only rejects bitmap fonts, they don't disable embedded bitmaps, which is the case here. I don't know why they didn't put the setting to disable embedded bitmaps in the same conf file. Anyways, put the following in your ~/.config/fontconfig/conf.d/20-no-embedded.conf (or, for older versions of Ubuntu, in ~/.fonts.conf.d/20-no-embedded.conf):

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

This will disable embedded bitmap for all fonts. If you want to disable only for select fonts, add <test> element:

<test name="family" compare="contains">
  <string>Calibri</string>
  <string>Cambria</string>
</test>

before <edit ....

4
  • Should this be put in /etc/fonts/conf.d, or better in /etc/fonts/conf.avail and symlinked to conf.d, like all the other config files? Is this reserved for the config files provided by the ubuntu distribution? Does it matter?
    – knb
    Commented Apr 21, 2012 at 15:50
  • 1
    @knb by default ubuntu/debian settings, fontconfig will load anything in ~/.fonts.conf.d/ as well. So I suggest you put it there to avoid mucking with system configs. Unless you want to make it available to all users, then you can put it in /etc/fonts/conf.d, or put it in avail and symlink it to conf.d to use it when you need it (you can delete the symlink when you feel like turning it on, vice versa)
    – syockit
    Commented Apr 22, 2012 at 16:26
  • 3
    With current versions of fontconfig, the file name must be ~/.fonts.conf.d/20-no-embedded.conf it won't be loaded if it isn't prefixed with a number. Run for example FC_DEBUG=1024 gedit to see if your configuration is loaded at all if it doesn't seem to have any effect.
    – pascal
    Commented Oct 26, 2012 at 12:58
  • @pascal +1 for FC_DEBUG. And no, number before name was not necessary on 10.04 LTS, just having it named .fonts.config was enough. What version of fontconfig you refer to? Commented Feb 5, 2013 at 15:09
1

In the example you give you have the "<string>" attribute mentioned twice in the "<test>" stanza. This causes a warning on Ubuntu 13.10 and 14.04. To eliminate the warning the stanza in the file should look like:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="font">
    <test name="family" compare="contains">
       <string>Calibri</string>
       <string>Cambria</string>
    </test>
    <edit name="embeddedbitmap" mode="assign">
      <bool>false</bool>
    </edit>
  </match>
</fontconfig>

You must log in to answer this question.

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