Chiu Yau 2022-08-28 02:50:53 it, nextcloud, collabora

How to add new fonts on Collabora Online - Built-in CODE Server?

How to add new fonts on Collabora Online - Built-in CODE Server?

It works for me! I am adding new fonts to NextCloud Office ( Collabora Online - Built-in CODE Server ) as I found that it does not support Chinese characters originally.

My settings areļ¼š Ubuntu, Apache 2.4.52, MySQL 8.0, PHP 8.1 ( LAMP, non docker environment )

Here’s how i made it:

  1. Put fonts files in any path that are listed in /etc/fonts/fonts.conf (i.e. /usr/share/fonts/truetype by default)
  2. Run fc-cache -f -v
  3. Supposingly, you should see some output like this:
    /usr/share/fonts: caching, new cache contents: 0 fonts, 1 dirs
    /usr/share/fonts/truetype: caching, new cache contents: 0 fonts, 2 dirs
    /usr/share/fonts/truetype/dfkai-sb: caching, new cache contents: 6 fonts, 0 dirs
    /usr/share/fonts/truetype/dfkai-sb: caching, new cache contents: 1 fonts, 0 dirs
    /usr/local/share/fonts: caching, new cache contents: 0 fonts, 0 dirs
    /home//.local/share/fonts: skipping, no such directory
    /home//.fonts: skipping, no such directory
    /usr/share/fonts/truetype: skipping, looped directory detected
    /usr/share/fonts/truetype/dejavu: skipping, looped directory detected
    /usr/share/fonts/truetype/dfkai-sb: skipping, looped directory detected
    /var/cache/fontconfig: not cleaning unwritable cache directory
    /home//.cache/fontconfig: cleaning cache directory
    /home//.fontconfig: not cleaning non-existent cache directory
    fc-cache: succeeded

dfkai-sb is the font i added.
The above command do the caching job and shows the output.

  1. It is done.
  2. Back to the Nextcloud Office Editor ( Collabora Online - Built-in CODE Server ), you can see the font you added listed in the font selector. ( If not, try restart the apache service by sudo systemctl reload apache or even sudo systemctl restart apache and reboot your server. For me, I cannot see it after these all because I am using Cloudflare, so after these, turn on Development Mode in Cloudflare (only if you are using Cloudflare caching) to see effects immediately. )

This should help those using Collabora with Nextcloud in LAMP environment.