Euro-Office in Nextcloud AIO: Adding Fonts

One advantage of having a Euro-Office container that is running on a server that is separate from my Nextcloud installation was that I could map the fonts directory to a directory on the host to have extra fonts I require. In the Nextcloud AIO setup with Euro-Office I described in an earlier post, this doesn’t work because Nextcloud AIO controls the containers directly, so I can’t map the font directory. So I had to find a different solution to get those fonts and my own special fonts into the Euro-Office environment.

The solution: Inject all additional fonts I require into the Euro-Office container while it is running as part of the Nextcloud AIO installation and run the font detection script inside the container.

Speaking of fonts: In addition to my special fonts, I noticed that the Euro-Office image does not come with the standard MS fonts such as ‘Times New Roman’, etc. etc.. This is understandable, but it gets in the way in many situations. So in case you wonder where to get the MS fonts from: If you use them on Ubuntu Linux, have a look in /usr/share/fonts/truetype/msttcorefonts/. From there, copy/paste the fonts to another directory and delete the logical links to particular font styles, they are not required by Euro-Office.

Back to the topic at hand: After experimenting a bit, I could condense the approach to the following commands on the shell on my Nextcloud AIO virtual machine:

sudo -s

# 1. Create the target directory inside the Euro-Office container
#
docker container exec nextcloud-aio-eurooffice mkdir -p /usr/share/fonts/truetype/custom

# 2. Copy the tarball into the container
#
docker cp /my-directory/my-special-fonts.tar.gz nextcloud-aio-eurooffice:/tmp/my-special-fonts.tar.gz

# 3. Extract inside the container and clean up
#
docker container exec nextcloud-aio-eurooffice bash -c \
  'tar xzf /tmp/telekom-fonts.tar.gz -C /usr/share/fonts/truetype/custom && rm /tmp/my-special-fonts.tar.gz'

# 4. Regenerate Euro-Office's font cache / AllFonts.js inside 
# the container
#
docker exec nextcloud-aio-eurooffice /usr/bin/documentserver-generate-allfonts.sh

And that’s it, no restart required, the fonts appear in the font list the next time Euro-Office is used with a document on the Nextcloud server.

The only catch: This solution is not persistent. When the Euro-Office container is started or updated the procedure has to be repeated unless and until this pull request that makes changes to the font directory persistent in the backup has been implemented.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.