lucab85 / avg

Source of Docker image lucab85/avg https://quay.io/lucab85/avg
https://hub.docker.com/r/lucab85/avg
MIT License
5 stars 6 forks source link

Custom font support #11

Open jmernin opened 2 years ago

jmernin commented 2 years ago

If your slide deck used custom fonts (e.g. Red Hat Display), which are not available inside the docker container, then the resulting video may contain incorrectly formatted slides. It may be worth exploring if there's any way to add the .ttf files for the fonts in question to the ARI ecosystem.

jmernin commented 2 years ago

I wonder if we were to add the required .ttf files (which are available from https://github.com/RedHatOfficial/RedHatFont) into the /usr/share/fonts directory in the docker image, would that help?

jmernin commented 2 years ago

So, good news. I manually copied some of the .ttf files downloaded from above into the /usr/share/fonts folder on the docker image and ran the "fc-cache -f -v" command to refresh the font cache (using guidance from this article: https://medium.com/source-words/how-to-manually-install-update-and-uninstall-fonts-on-linux-a8d09a3853b0).

I then regenerated my video once more and it looks like my text alignment issues are all fixed, so this looks like a viable solution!

jmernin commented 2 years ago

Minor correction: I think we should place a copy of the .ttf files in a subfolder within /usr/share/fonts (e.g. /usr/share/fonts/redhat). I've tested this and it works and it's a little cleaner too.

lucab85 commented 2 years ago

Feature implemented by PR #18

jmernin commented 2 years ago

I tried out the latest image today and I'm afraid that the wrong set of .ttf files have been copied into it (and they've not been placed in a "redhat" subdirectory as recommended). They're also appearing with slightly odd-looking filenames (i.e. see the single quotes in the names):


# ls -l /usr/share/fonts/
total 536
-rw-r--r-- 1 root root 99976 Apr 25 13:15 'RedHatDisplayVF-Italic[wght].ttf'
-rw-r--r-- 1 root root 96656 Apr 25 13:15 'RedHatDisplayVF[wght].ttf'
-rw-r--r-- 1 root root 71928 Apr 25 13:15 'RedHatMonoVF-Italic[wght].ttf'
-rw-r--r-- 1 root root 66180 Apr 25 13:15 'RedHatMonoVF[wght].ttf'
-rw-r--r-- 1 root root 98836 Apr 25 13:15 'RedHatTextVF-Italic[wght].ttf'
-rw-r--r-- 1 root root 94232 Apr 25 13:15 'RedHatTextVF[wght].ttf'
drwxr-xr-x 3 root root  4096 Apr 25 12:53  truetype```
jmernin commented 2 years ago

While it's still fresh in my mind, here are the correct font files I believe are needed to ensure everything works here (assuming you've cloned/downloaded the full font repo from https://github.com/RedHatOfficial/RedHatFont):

$ mkdir avg/share/fonts
$ cp RedHatFont/fonts/proportional/static/ttf/*.ttf avg/share/fonts
$ cp RedHatFont/fonts/mono/static/ttf/*.ttf avg/share/fonts

In the case of the slide decks I've been using, I'm not sure the mono fonts are ever needed or used but there's certainly no harm in having them present anyway.