Problems with ttf font rendering under LibreOffice

9,531

Solution 1

Fonts like Calibri and Cambria resort to using embedded bitmaps when adjusted to small sizes.

To disable this font behaviour, put the following into $HOME/.fonts.conf:

<match target="font" >
     <edit name="embeddedbitmap" mode="assign">
         <bool>false</bool>
     </edit>
</match>

Create the file if it doesn't exist.

Restart to take effect.

Sources
http://ubuntuforums.org/showthread.php?t=724818 (registration required)
http://manpages.ubuntu.com/manpages/precise/man5/fonts-conf.5.html

NOTE:
$HOME/.fonts.conf is deprecated in Ubuntu 12.10 Instead, paste the above XML code (as root) in /etc/fonts/conf.d/50-user.conf

Solution 2

Instead of putting the XML code in /etc/fonts/conf.d/50-user.conf (which actually just includes files from $HOME/.config/fontconfig/conf.d or $HOME/.config/fontconfig/fonts.conf) put the XML code in a file under the two mentioned directories in your $HOME/.config/fontconfig/ directory. Don't mess with the system configuration files as this will make system upgrades more complicated.

Solution 3

I solved this for my system by removing the Calibri font, installing Carlito, which is "metric-compatible with Calibri" and is packaged with "a mapping entry to fontconfig (local.conf)," refreshing my font cache, and restarting LibreOffice:

$ rm ~/.fonts/microsoft/CALIBRI*
$ sudo apt install fonts-crosextra-carlito
$ fc-cache

Here's a before and after with Microsoft at the top and Carlito below:

Calibri tests

You can do the same with Caladea for Cambria with fonts-crosextra-caladea and you can use Croscore fonts Arimo, Tinos, and Cousine for Arial, Times New Roman, and Courier New with fonts-croscore.

See my full post for more details.

Solution 4

I ran into this issue on Ubuntu LTS 18.04, and then again after upgrading to 20.04 LTS. Calibri looked horrible on LibreOffice and Firefox. The above method worked for me as follows:

Create the file described above and save as fonts.conf in $HOME/.config/fontconfig

Then rebuild the font cache: sudo fc-cache -fv

I'm not sure if the last step was necessary, but I did it anyway before checking the font rendering.

Calibri now looks perfect on LibreOffice and in Firefox.

Share:
9,531

Related videos on Youtube

Glutanimate
Author by

Glutanimate

Medical student, hobbyist programmer. https://www.youtube.com/c/glutanimate

Updated on September 18, 2022

Comments

  • Glutanimate
    Glutanimate over 1 year

    Microsoft TTF-fonts such as Calibri and Cambria aren't rendered correctly at certain page zoom levels:

    Comparison between the system font and Cambria at different zoom levels

    I installed the Microsoft fonts manually by placing them in the ~/.fonts directory and updating the font cache.

    Is there any way to improve Microsoft font rendering under LibreOffice?

  • Glutanimate
    Glutanimate over 11 years
    This worked great, thank you! Makes we wonder why this isn't the default behaviour. Are there any downsides to disabling the embedded bitmaps?
  • loklaan
    loklaan over 11 years
    @Glutanimate As far as I'm aware, very few fonts use this technology. So you should never run into any problems. I agree, this should be default in the global fonts.conf
  • Alan De Smet
    Alan De Smet over 8 years
    For 14.04, ~/.config/font-manager/local.conf is a better location to add that (assuming you don't want to mangle the system-wide setting.)
  • Ben
    Ben over 2 years
    You do not need to restart, just run fc-cache -f and re-open whatever application was rendering the font