Problem to use a new font (ttf)

Hi, I’m trying to use a new font (ttf) in my Python program (in this case there is no way to set a path directly to the font, the font needs to be accessed by system) and I having no success when I run the program online (website).

If I log in server and run the program in Shell, the new font can be used correctly. I’m putting the font in the correct path: ~/.local/share/fonts or ~/.fonts (old way), command fc-cache, etc…

But when I run in browser, I can´t use the new font. I already tried to set the path with fc-cache.

I have a shared plan. Is there a way to use a new font? I have to put it in any specific directory, or set some file, or variable?

Thanks in advance for any help.

You mention putting the font in ~/local/share/fonts, but searching around I see references to using: ~/.local/share/fonts (note the dot local). Could that be the problem?

No. I just forgot to type the ‘.’ here. Corrected.

Using ~/.local/share/fonts works for my user (SSH), the problem occurs in Web (public access).

I want to install fonts for all users, and I don’t know how to configure local.conf and/or fonts.conf

I don’t believe this is possible on any of DH’s managed plans (Shared or VPS), since you’d presumably need root access. However, I think you’d only need to access the font from the website’s user.

I’m guessing the issue might be some difference between your shell and web environment. For example, when running a CGI script, the HOME environment variable isn’t set, PATH is minimal, etc. Maybe you could give some more details: Are you running Python from CGI or Passenger? What package or program is trying to access the font? Can you configure font search paths?

[ Note: I’m not a Python expert, so the best I can do is be a rubber duck. ]

1 Like

You solved the problem. Setting HOME solved it. Thanks a lot.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.