Is there any way to specify to libreoffice, via commandline, to use Cambria for occurences of Calibri in the PDF generation without the need of any user-interaction?


I am using this command:

libreoffice --headless --invisible --convert-to pdf --outdir images/output/ images/Mockups.pptx

or this one:

unoconv -f pdf -o images/output/ images/Mockups.pptx

to automatically convert a PPTX to PDF in a virtualbox machine launched with vagrant running ubuntu/trusty64.


config.vm.box = "ubuntu/trusty64"
config.vm.provision "shell", inline: <<-SHELL
    sudo apt-get update
    sudo apt-get install -y unoconv imagemagick default-jdk ant docbook-xsl fop libxml2-utils xsltproc php5-cli

The original pptx is edited by people using windows and uses the Calibri font. I can't require them to use different settings or fonts.

As the Calibri font is not in the trusty distribution, the PDF conversion done by the libreoffice messes the layout.

I've read Cambria is metric-equivalent to Calibri.

So, as stated, the question is how to instruct libreoffice for a certain font substitution via command line.

  • Related to: stackoverflow.com/questions/9548755/… - This is what I was trying to achieve. – Xavi Montero Feb 25 '15 at 14:13
  • A quick and dirty solution would be to create symbolic links from the Calibri font files to the corresponding Cambria files. – Jos Feb 25 '15 at 14:17

The pptx file format is just a zip file with a different extension, you could try unzipping it and doing a text substitution:

unzip -d tmp Mockups.pptx
find tmp -type f | xargs sed -i 's/Calibri/Cambria/g'
( cd tmp; zip -r ../Mockups2.pptx . )
rm -Rf tmp
  • Thanks for the tip! Didn't know it's a ZIP. This Works! Nevertheless, the sed must have a /g to process several occurences of the happening within the same file. Finally mention that the zip seems not to support compressing a dir stripping the first path element, so we need to cd into it necessarily. I'm going to edit the answer with the script that works. – Xavi Montero Feb 25 '15 at 18:02
  • @XaviMontero: Please feel free to edit my script, we don't really need my half-baked version, and the edits are versioned anyway. – krlmlr Feb 25 '15 at 21:52
  • Edited. Submitted for peer-review. – Xavi Montero Feb 27 '15 at 10:12
  • 1
    @XaviMontero: Reviewers were too eager... I edited it myself. – krlmlr Feb 27 '15 at 12:34

We had a similar issue with LibreOffice under Alfresco (which also runs headless). Installing the ChromeOS fonts packages for Carlito (Calibri equivalent) and Caladea (Cambria equivalent) fixed it, using a hint from here: https://wiki.debian.org/SubstitutingCalibriAndCambriaFonts. Changing the mappings within LO did nothing, neither on the headless nor on the desktop - only installing the packages solved it. (For completeness, we had added the entries for the mappings to the LO registrymodifications.xcu and that achieved nothing, on either platform - editing the files under conf.d takes precedence, it seems).

Packages installed were:

Note: $ below is the system prompt...


$ sudo apt-get install fonts-crosextra-carlito fonts-crosextra-caladea

FreeBSD: (Hint:do the search first as name may change over time)

$ pkg search cros

$ sudo pkg install crosextrafonts-caladea-20130214_1 crosextrafonts-carlito-20130920_2

You may need to run:

$ fc-cache -r

Check with:

$ fc-match Calibri

Carlito-Regular.ttf: "Carlito" "Regular"

$ fc-match Cambria

Caladea-Regular.ttf: "Caladea" "Regular"

Works perfectly now.

These installs create the following files which give the desired font substitutions (depending on your platform):

Linux (Ubuntu 14.x):



These are linked from /etc/fonts/conf.d like so:

30-0-google-crosextra-caladea-fontconfig.conf -> ../conf.avail/30-0-google-crosextra-caladea-fontconfig.conf

30-0-google-crosextra-carlito-fontconfig.conf -> ../conf.avail/30-0-google-crosextra-carlito-fontconfig.conf

FreeBSD (10.x):


...linked ala...

/usr/local/etc/fonts/conf.d/30-metric-aliases.conf@ -> /usr/local/etc/fonts/conf.avail/30-metric-aliases.conf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.