Configure fontconfig to ignore bitmaps in scalable fonts

6,630

Solution 1

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

Solution 2

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>
Share:
6,630

Related videos on Youtube

Paul Fisher
Author by

Paul Fisher

Updated on September 17, 2022

Comments

  • Paul Fisher
    Paul Fisher over 1 year

    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.

    • JanC
      JanC over 13 years
      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?
    • Paul Fisher
      Paul Fisher over 13 years
      @JanC The fonts do indeed use prerendered bitmaps.
  • knb
    knb about 12 years
    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?
  • syockit
    syockit about 12 years
    @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)
  • pascal
    pascal over 11 years
    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.
  • LAFK says Reinstate Monica
    LAFK says Reinstate Monica over 11 years
    @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?