Does anyone happen to know how to add custom fonts to Cryptpad? I recently installed Cryptpad using Docker and noticed there was only a small selection of fonts included with the OnlyOffice installation. One of the key fonts missing being Times New Roman which is used by a large portion of schools.
Thanks.

    CandyLords hello!

    Thanks for your interest in CryptPad.

    As of today, it's not possible to add custom fonts to our OnlyOffice integration. However, it could be an interesting feature request.

      Mathilde Good to know. In my opinion it's a key feature because it gives the user so much more customization with how their documents look. And as I previously mentioned particularly schools tend to require certain fonts that most likely will not be included in the current supported list.

      6 days later

      @CandyLords Thanks for your suggestion, I can see this feature being useful. However it is unlikely to be implemented any time soon for technical reasons. At the moment the selection of fonts is included with the applications. Opening this up for user upload would mean somehow storing font files with the user account, which in our end-to-end encrypted setup would mean re-downloading the fonts each time the document is opened. This alone could be overcome but real problems would arise when other users would open the document as they would not be able to download and decrypt the fonts uploaded by another user.

      Long story short this feature is not present in OnlyOffice as far as I'm aware, but it's even less likely to be added to the CryptPad integration because of our privacy focus.

      3 months later

      Wouldn't a workaround for the privacy thing be to have the option to add fonts instance-wide? Sure, that would not enable anyone to add their own fonts, but it would definitely be better than no option for alternative fonts at all.

      It looks like OnlyOffice does provide a way of installing custom fonts instance-wide, though I have not been able to figure out how to make that work with Cryptpad, as I have not been able to find the shell script they refer to.
      https://helpcenter.onlyoffice.com/docs/installation/docs-community-install-fonts-linux.aspx
      I would really really like to be able to add a custom font to my installation. It does not matter to me if I can do it the 'normal' way or if I would have to create several files myself. Though I do not succeed in obtaining the tools that the script uses, so I have no way of creating required files myself. (Or I have not yet found the right things.)
      I shouldn't say that this is a big issue, because until recently I did not even know that CryptPad has an OnlyOffice integration, but now I know that, yeah, it is now a big issue for me to not be able to add a custom font in any way whatsoever.

      4 days later

      I have today successfully managed to add custom fonts to the OnlyOffice in my Cryptpad instance.
      For future reference, this is what I did:

      Before you begin, please create a backup of your Cryptpad instance, just to be sure.
      Note: I run a Yunohost installation of Cryptpad, so it could be that some of the files are stored in a bit different locations than usual. Nonetheless, the steps described here should, I feel, give you a pretty good idea of what to do.
      Note: the v7 bit in the file paths might be different for you, depending on what the most recent OnlyOffice installation is in your Cryptpad instance.

      I cloned the nextcloud 'documentserver_community' github repo and ran make:
      git clone https://github.com/nextcloud/documentserver_community.git
      cd documentserver_community
      make

      Make did complain about something, but when I looked for the magic script needed, it was there.
      If you have now an executable at 3rdparty/onlyoffice/documentserver/tools/allfontsgen, you can get your fonts compiled.

      Now, you place all the fonts that your OnlyOffice should have in a folder.
      For example, what I did on my personal computer was:
      cd 3rdparty/onlyoffice/documentserver/server/tools
      mkdir fonts
      And on my server:
      sudo tar -czvf OnlyOfficeFonts.tar.gz /var/www/cryptpad/www/common/onlyoffice/dist/v7/fonts/*
      And then again on my own PC:
      cd fonts
      scp USER@SERVER:~/OnlyOfficeFonts.tar.gz fonts.tar.gz
      tar -xzvf fonts.tar.gz
      And then I copied all the additional fonts I wished to have to documentserver_community/3rdparty/onlyoffice/documentserver/server/tools/fonts/var/www/cryptpad/www/common/onlyoffice/dist/v7/fonts/
      (Yes, that is awfully long, and unnecessarily so. But this is how I did it.)
      It is very important to also move all additional fonts to your server:
      scp var/www/cryptpad/www/common/onlyoffice/dist/v7/fonts/YOUR_FONT.ttf USER@SERVER:~/
      And then on the server:
      sudo cp YOUR_FONT.ttf /var/www/cryptpad/www/common/onlyoffice/dist/v7/fonts/
      (And I also did the next command, though possible it will work without it as well.)
      sudo cp YOUR_FONT.ttf /usr/share/fonts/truetype/

      Now, you're ready to compile the fonts for use in your Cryptpad's OnlyOffice.
      On my own PC I ran:
      cd ..
      ./allfontsgen \
      --input="fonts/var/www/cryptpad/www/common/onlyoffice/dist/v7/fonts" \
      --allfonts-web="../../sdkjs/common/AllFonts.js" \
      --allfonts="../FileConverter/bin/AllFonts.js" \
      --images="../../sdkjs/common/Images" \
      --output-web="../../fonts" \
      --selection="../FileConverter/bin/font_selection.bin"

      Then I had to edit one of the two AllFonts.js files, for else it would not work.
      Make sure, with your favourite text editor, to find+replace all fonts filenames so as to remove the path, in ../FileConverter/bin/AllFonts.js, as it will not work when the path remains. (And it is, indeed, not in your original AllFonts.js file on the server either.)
      Once you've done that, it's time to move things to your server!
      The most obvious step might be this one:
      scp ../FileConverter/bin/AllFonts.js USER@SERVER:~/
      But please remember to also do the following step, as otherwise you'll have the fonts, but not the font name preview things.
      cd ../../sdkjs/common/Images
      tar -czvf FontImages.tar.gz fonts*
      scp FontImages.tar.gz USER@SERVER:~/
      And then finally on your server:
      tar -xzvf FontImages.tar.gz
      sudo cp fonts_thumbnail* /var/www/cryptpad/www/common/onlyoffice/dist/v7/sdkjs/common/Images/
      sudo cp AllFonts.js /var/www/cryptpad/www/common/onlyoffice/dist/v7/sdkjs/common/

      And that's it! Now you can use your custom fonts.