CollaboraOnline / online

Collabora Online is a collaborative online office suite based on LibreOffice technology. This is also the source for the Collabora Office apps for iOS and Android.
https://collaboraonline.com
Other
1.78k stars 681 forks source link

remote font download code assume ttf files thus failling on otf files #7526

Open rriemann opened 11 months ago

rriemann commented 11 months ago

Describe the Bug

I use Collabora with Nextcloud. Collabora has a very good text render engine called HarfBuzz that works AFAIK best with otf fonts. Libertinus in otf is our house font.

Uploaded to the Nextcloud admin area, Nextcloud produces a font config file like:

{
  "kind": "fontconfiguration",
  "server": "Robert's Cloud (https://cloud.local)",
  "fonts": [
    {
      "uri": "https://cloud.local/apps/richdocuments/settings/fonts/Font%20Awesome%206%20Free-Regular-400.otf",
      "stamp": "8d55a1c9d11f0448df73dc7172d02999"
    },
    {
      "uri": "https://cloud.local/apps/richdocuments/settings/fonts/Font%20Awesome%206%20Free-Solid-900.otf",
      "stamp": "44a2864a3d7f6cedd84db4bb51df5ee8"
    },
    {
      "uri": "https://cloud.local/apps/richdocuments/settings/fonts/LibertinusKeyboard-Regular.otf",
      "stamp": "54c2dcba24f111d54f626afd7f6a9660"
    },
    {
      "uri": "https://cloud.local/apps/richdocuments/settings/fonts/LibertinusMath-Regular.otf",
      "stamp": "00349a593e0877ab65653c9a03307099"
    }
  ]
}

However, I cannot find those fonts imported to CollaboraOffice. Intead, I found that the code to download those fonts to the collabora server has:

https://github.com/CollaboraOnline/online/blob/83fb699f7f20ce5b479aab77d764238d5d2d2ff0/wsd/COOLWSD.cpp#L1989

It looks like the files will all be given the ttf extension – also if the files are in fact in otf format.

Steps to Reproduce

  1. Go to nextcloud and upload an otf font (you need to switch the filter to all files, as nextcloud limits to ttf)
  2. Configure --o:remote_font_config.url in Collabora Online
  3. check with Writer that fonts are not available.

Expected Behavior

I can see those fonts

Actual Behavior

I cannot see those fonts

timar commented 10 months ago

Are you sure that file extension is the problem? I downloaded a random otf font from https://www.1001fonts.com/opentype-fonts.html and it worked for me.

rriemann commented 10 months ago

Are you sure that file extension is the problem? I downloaded a random otf font from https://www.1001fonts.com/opentype-fonts.html and it worked for me.

Do you know in which folder collabora (Docker CODE) stores the file? I could check if the download worked already.

sebastiaanveld commented 10 months ago

I added two fonts (Tahoma.ttf and Pecita.otf), the only thing I can find in the container is: /opt/cool/child-roots/1-958b67f7/tmp/incoming/41e43f93.ttf /opt/cool/child-roots/1-958b67f7/tmp/incoming/6f5735e4.ttf

The fonts I uploaded are one .ttf and and one .otf, but but the otf 'translates' to a .ttf in the container.

timar commented 10 months ago

The fonts I uploaded are one .ttf and and one .otf, but but the otf 'translates' to a .ttf in the container.

But did it work? That's the real question, because probably functionality is independent from file name extension. It works for me, but I'd like to hear confirmation from others.

sebastiaanveld commented 10 months ago
The fonts I uploaded are one .ttf and and one .otf, but but the otf 'translates' to a .ttf in the container.

But did it work? That's the real question, because probably functionality is independent from file name extension. It works for me, but I'd like to hear confirmation from others.

@timar Yes, it does work for me :)

rriemann commented 10 months ago

I have pulled again the most recent CODE docker container (COOLWSD version: 23.05.5.3 git hash: 5093121)

I can see 17 files in my NC fonts.json and 17 files in the directory /opt/cool/child-roots/1-a51cfe9e/tmp/incoming. Still, none of the fonts is selectable when I open an odt file from NC.

So it does not work for me.

@sebastiaanveld could you try with the otf files from Font Awesome 6 Free for Desktop? I uploaded all otf font variants.

Download: https://fontawesome.com/v6/download

sebastiaanveld commented 10 months ago

Fonts show up in the font menu: image

The font applies to text succesfully:

image

Did you restart your container after adding the fonts to Nextcloud?