Skip to content

Instantly share code, notes, and snippets.

@AntonFriberg
Created May 28, 2020 17:00
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AntonFriberg/d9d0e7a6316cd8badfaaf1c81fa8b150 to your computer and use it in GitHub Desktop.
Save AntonFriberg/d9d0e7a6316cd8badfaaf1c81fa8b150 to your computer and use it in GitHub Desktop.
Fix ugly Calibri, Cambria font rendering on Linux
<!-- Add this to your font configuration e.g ~/.config/fontconfig/fonts.conf -->
<!-- Note that this will disable all embedded bitmaps in fonts that use them -->
<!-- disable embedded bitmaps in fonts to fix Calibri, Cambria, etc. -->
<match target="font">
<edit mode="assign" name="embeddedbitmap"><bool>false</bool></edit>
</match>
@AntonFriberg
Copy link
Author

AntonFriberg commented May 28, 2020

This is before the change using the following text

This is a test on calibri that is rendering with size 12pt on a 1920x1080 screen using "Calibri". Some things like doubt t (tt) look terrible. Hinting is also completely broken making it difficult to read text:
The lazy dog jumped over the crazy fox

This is a test on calibri that is rendering with size 12pt on a 1920x1080 screen using "Calibri". Some things look terrible like f i (fi) and ( ). Hinting is also completely broken making it difficult to read text:
The lazy dog jumped over the crazy fox

However Linux native fonts look a lot better and is rendered correctly, tt, fi ()
The lazy dog jumped over the crazy fox

Before

Note that the second test is cambra not calibri
scrn-2020-05-28-19-08-22

@AntonFriberg
Copy link
Author

AntonFriberg commented May 28, 2020

After

Note that the second test is cambra not calibri
scrn-2020-05-28-19-11-42

@AntonFriberg
Copy link
Author

Before & After in single image

fontrendering_before_after

@graves501
Copy link

Thanks for sharing this fix!

@JoKalliauer
Copy link

However printing PDFs, does not print Ligatures:

Scanned printed PDF:
0425_001 svg

Instead of orignial PDF:
CMAMES22013051OCS_

@AntonFriberg
Copy link
Author

Did not know that font rendering could affect printing. Perhaps it depends on the printer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment