fontscentos7fontconfig

Installing fonts on CentOS from the /tmp/ folder


I am trying to create a process on a machine that can asynchronously download and install fonts for LibreOffice to use. Our processes for whatever reason cannot access the usr folder, and every guide to installing fonts mentions to first move the file to a subdirectory in /usr/share/fonts/. Is it possible to install them from /tmp? Here is what I have tried:

  1. Create a folder /tmp/fonts
  2. Download the Lato-Black.ttf into that folder
  3. Run the following commands:
os.system('chmod -R a+r /tmp/fonts/')
os.system('chmod a+x /tmp/fonts/')
os.system('fc-cache -rfv /tmp/fonts/')

Separately I have a process that runs the following bash:

'while :; do echo ___; ls /tmp/fonts; fc-list; sleep 60; done'

This process shows that the font is downloaded to the tmp folder, but the fc-list command is not showing Lato as one of the installed fonts. Any idea what may be going on?


Solution

  • Make sure you add /tmp/fonts to the list of searched directories in the config file. The config file might be in:

       /etc/fonts/fonts.conf
       /etc/fonts/fonts.dtd
       /etc/fonts/conf.d
       $XDG_CONFIG_HOME/fontconfig/conf.d
       $XDG_CONFIG_HOME/fontconfig/fonts.conf
       ~/.fonts.conf.d
       ~/.fonts.conf
    

    More info