Reputation: 61
When convert pdf page to image, if a Font is not embedded in the input pdf, default Font substitution (usually Arial) is used. However, I want to change the default font.
There is a description here but it is too few information. I don't know how to create and where to put the config file.
OS: Ubuntu 18.04
Upvotes: 5
Views: 2397
Reputation: 50623
For Fedora, I created ~/.config/fontconfig/fonts.conf
with following content:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<test name="family">
<string>Helvetica</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Liberation Sans</string>
</edit>
</match>
</fontconfig>
It worked fine, tested with fc-match Helvetica
and pdffonts -subst <yourfile>.pdf
I recommend the arch linux wiki for more font configuration info.
Upvotes: 1
Reputation: 536
The page you mentioned saved me, thanks! Here is how:
As they indicate, what is needed is to configure fontconfig
. I can't be sure for Ubuntu, but for Debian this means creating or editing this file :
/etc/fonts/local.conf
For the font substitution, you just need to include something like this example:
<alias>
<family>Helvetica</family>
<accept><family>Nimbus Sans L</family></accept>
</alias>
Where the Helvetica family would be substituted by the 'Nimbus Sans L' family.
To check that it works, you may use a PDF file containing e.g. Helvetica, and type:
pdffonts -subst <yourfile>.pdf
This will list the fonts substitutions. In my case, it worked just fine, with poppler now doing the right substitution.
Upvotes: 3