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.

Paul Fisher
  • 487
  • 3
  • 12

2 Answers2

20

/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 ....

Frederik
  • 189
  • 8
syockit
  • 328
  • 3
  • 9
  • 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 Apr 21 '12 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 Apr 22 '12 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 Oct 26 '12 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? – LAFK says Reinstate Monica Feb 05 '13 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>