Installing new fonts in Collabora

I installed collabora on a debian stretch instance without docker.
After some struggles I got it to work.
https://help.nextcloud.com/t/native-debian-9-collabora-package-does-not-install-correctly/21191/13
and
https://help.nextcloud.com/t/tools-language-for-is-showing-code-instead-of-options/22213/4
did the trick.
Still fonts used on the users laptops and desktops (microsoft) using LibreOffice and some MSOffice are not available.
A possibile solution in https://help.nextcloud.com/t/i-want-to-prevent-design-collapse-by-font-in-collabora/22676/7 did not work.
(Same I found in https://central.owncloud.org/t/howto-install-collabora-online-on-ubuntu-16-04-without-docker/3844/9)

The way to add fonts that did work I found here: https://www.pcworld.com/article/2863497/how-to-install-microsoft-fonts-in-linux-office-suites.html.
It is explained for Ubuntu, but also works in debian.

For the core MS fonts:

sudo apt-get install ttf-mscorefonts-installer

You may be asked to accept the license agreement, i was not asked.

They end up in /usr/share/fonts/truetype/msttcorefonts

Next is to install the clear types such as calibri.

This is a bit different but can be done with the vista fonts installer script.
Make sure you have the appropriate permissions.
Create a .font folder as the script needs that.

mkdir .font
wget -qO- http://plasmasturm.org/code/vistafonts-installer/vistafonts-installer | bash

all new fonts are installed in the .font folder

in /usr/share/fonts/truetype create folder msttvistafonts

copy all fonts from the .fonts folder to /usr/share/fonts/truetype/msttvistafonts
change the ownerships to the same as that in the other fonts if needed.

Now run

fc-cache

Restart loolwsd.service and the fonts are available.

I am reviving this old topic as it is applicable to “Installing new fonts in Collabora” and I could not find a solution to my problem on the NextCloud forums.

I attempted to add my own fonts on a non-docker server as well and ran into an issue similar to that is mentioned here (also described in the next paragraph).

Where fonts were displayed in the drop down list of fonts to choose form in Collabora, but they didn’t actually appear on the document, even though the text was still there it was not actually visible.

It took me a few hours but I solved it and I posted my solution at the above link, but I will also post it in here since I have nothing to do with the nethserver community and I originally searched for the answer here but could not find it.

So, here’s what I’ve done
Installed five additional custom fonts.
Four of which are copied straight from the Windows 10 Fonts folder (Arial, Calibri, Consolas, Verdana)
One from Google Fonts (Roboto); downloaded directly from fonts.google(.com) as a zip file

Uploaded them all to the server manually (SFTP) and placed each font set in their own respective folders like so, ensuring all were world readable:

ls -al /usr/share/fonts/truetype/
drwxr-xr-x 9 root root 4096 Apr 14 14:41 .
drwxr-xr-x 4 root root 4096 Apr 14 14:33 ..
drwxr-xr-x 2 root root 4096 Apr 14 14:34 arial
drwxr-xr-x 2 root root 4096 Apr 14 14:34 calibri
drwxr-xr-x 2 root root 4096 Apr 14 14:34 consolas
drwxr-xr-x 2 root root 4096 Apr 14 14:34 dejavu
drwxr-xr-x 2 root root 4096 Apr 14 14:34 lato
drwxr-xr-x 2 root root 4096 Apr 14 14:34 roboto
drwxr-xr-x 2 root root 4096 Apr 14 14:34 verdana

Copy all fonts to the following folders
/usr/share/fonts/truetype
/opt/lool/systemplate/usr/share/fonts/truetype

Run
fc-cache

Now this next command - you have to make sure that you adjust the version number to the one matching your Collabora installation for this folder: /opt/collaboraoffice6.2

Run AS ROOT (or just execute the actual command as the lool user)
su lool --shell=/bin/sh -c "loolwsd-systemplate-setup /opt/lool/systemplate /opt/collaboraoffice6.2 >/dev/null 2>&1"

And finally
systemctl restart loolwsd

Hopefully this works as well for others as it did for me.

Thanks @Sylice for this “update”! You mention:

I get no fc-update command on my Ubuntu server, here’s what fc commands I find:

fc-cache (1) - build font information cache files
fc-cat (1) - read font information cache files
fc-list (1) - list available fonts
fc-match (1) - match available fonts
fc-pattern (1) - parse and show pattern
fc-query (1) - query font files
fc-scan (1) - scan font files or directories
fc-validate (1) - validate font files

Did you mean fc-cache?

Hi, another problem is all the undesirable fonts (such as Noto* for instance) are back when you upgrade CODE…

My apologies you’re right it’s fc-cache, not fc-update. I will update that original post above.

As to getting rid of existing fonts and not allowing them to come back, I do not not how to help with that.

I did a crontab scheduled bash script to remove every night the list of fonts I don’t need in /opt/collaboraoffice6.2/share/fonts/truetype, followed by fc-cache and a systemctl loolwsd restart

:crazy_face:

I followed both @pieter and @Sylice instructions but I cannot even get the new fonts to show up in the list.
I installed msttcorefonts and msttvistafonts in both /usr/share/fonts/truetype/ and /opt/lool/systemplate/usr/share/fonts/truetype.
I run fc-cache and restarted loolwsd.service.
I did all with root user (not Nextcloud user) and the permissions for every folder are ```
drwxr-xr-x 2 root root 4096.

What could I have missed? Could it be I need to change permissions to include Nextcloud user, or maybe www-data?

1 Like

I did install this on a NON docker setup. The fonts are installed on the machine to be available to all.
For that, the fonts need the same permissions and ownership as all other already existing fonts available.

For running applications to accept, you need fc-cache and apps (loolwsd) to be restarted.