online
online copied to clipboard
Issue while installing custom fonts
I've installed a few custom fonts in a directory on the server and passed it as a volume for the docker container to both /usr/local/share/fonts/lool and /opt/lool/systemplate/usr/share/fonts/lool.
Now the fonts are displayed in the dropdown in the collabora online editor. When I select the new font the text vanishes and I can't select it.
The fonts are located directly in the directory and are in the format TTF.
Hi @JWaldecker and thanks for reporting this. A couple of questions:
- Which version are you using
- And I see that you have
loolwithin your paths so and depending on the version you are coming from you might need to migrate some of your configuration files. Those files were renamed in the recent versions- You can either check and make sure they have the proper naming: https://sdk.collaboraonline.com/docs/installation/Proxy_settings.html
- Or there is also a migration tool available
man man/coolconfig.1
migrateconfig
The migrateconfig command migrates config file of Collabora Online 6.4 or older to the new format.
migrateconfig [--old-config-file=<path>] [--config-file=<path>] [--write]
--old-config-file=path Specify file path for the old configuration manually. The default is /etc/loolwsd/loolwsd.xml.
--write Write migrated configuration. Without this option no changes are written to the config file, only information about differences between old and new config is printed.
Example: coolconfig migrateconfig --old-config-file=/etc/loolwsd/loolwsd.xml --config-file=/etc/coolwsd/coolwsd.xml --write
- Also can you have updated the systemplate manually? If not you can:
In Collabora Online 21.11 and newer:
coolconfig update-system-templateIn Collabora Online 6.4 and older:loolconfig update-system-template
Just guessing: Shouldn't the second path be /opt/lool/systemplate/usr/local/share/fonts/lool ?
I am using Nextcloud AIO (all-in-one) where Collabora is integrated. I would like to add new fonts, but don't know how. Any help, suggestion will be highly appreciated.
I am using the collabora docker image. I have a folder fonts, inside a folder for each font containing the ttf-files. I created a volume : ./fonts:/usr/share/fonts/truetype. All seven fonts show up in the dropdown list but are not rendered, just like described above. Then I changed the volume to point to /opt/cool/systemplate/usr/share/fonts/truetype and restarted the container. Now two of my seven fonts show up in the dropdown. Those two are Caudex and Rubik from Google, consisting of multiple ttf-files. The ones missing only have a single ttf-file in their respective folders.
Besides Caudex and Rubik are now rendered, but completely wrong:

This is what they should look like

I managed to get six of my seven custom fonts to render correctly. Don't know why the seventh font won't render correctly (it simply shows as a generic non-serif font), might be an issue with the font itself. I had to mount my folder with all my fonts to BOTH directories:
volumes:
- ./fonts:/opt/cool/systemplate/usr/share/fonts/truetype
- ./fonts:/usr/share/fonts/truetype
Afterwards, I stopped, removed and restarted the container, just to be sure.
I also stumbled over this bug and documented my findigs over at https://forum.collaboraonline.com/t/adding-fonts-to-collabora-online-causes-segfault/1493.
I also ran into this today when trying to setup fonts in /usr/local/share/fonts. They were picked up properly by fc-cache and also listed in the font select box but rendering was broken and I also had a crash (don't have access to the logs yet though for that instance).
Moving the fonts to /usr/share/fonts/truetype worked then.
The problem comes from coolwsd-systemplate-setup :
- L49 : copy
/var/cache/fontconfiginto new root - L124 : copy
/usr/share/fontsinto new root - but other directories are not taken into account. I guess all fonts listed by
fc-list ':' fileshould be copied into new root.
Note that the problem may be more general : it's not so easy to cherry-pick some essential files from a live system to make a chroot based on this system without missing parts (but this chroot is a very nice security measure, so it's worth trying !).
In order to add new fonts, binding folders between host and container no longer works (and maybe it has never worked properly by using huge collections). After reading the docs and try-and-error, the reliable way is: build a new docker image, copy the fonts to /usr/share/fonts/truetype and execute coolconfig as root user. Here an example:
FROM collabora/code:23.05.9.1.1
USER root
COPY fonts /usr/local/share/fonts/truetype
RUN fc-cache -fv && coolconfig update-system-template
USER cool