Forums

Install fonts ttf in python ayuwhere

how install new fonts from cosole

Do you want to use a different font inside the console? Unfortunately, you can't do that on PythonAnywhere. The console isn't a "real" console running on your machine, it's a JavaScript application running in the browser, so it's limited to the fonts we've configured it with.

On the other hand, if you want to use them from somewhere else (say, in an IPython notebook) then there are a number of possibilities -- let me know if that's what you're trying to do and I'll give you details.

Hello, i need install fonts ttf to my web site, how i do?

TTF fonts are not for websites. They are local to each machine. If you need specific fonts for your website, I would suggest googling around for "web fonts"

Hello Glenn,

I would like to also install some new fonts for my PA web application. Specifically, how can I install the font 'Arial' or 'Humor Sans' so it's available to my python application? Please let me know.

I basically want to increase default the list of fonts available to my application, e.g. the list I get when I run fc-list on a console in PA. Thanks!

may I ask what the usecase for this would be?

We've built an application to do display sequence logos, and we'd like to display characters in more fonts than currently available. As an example, please see the following two pictures. Our application uses matplotlib to draw the characters but we more fonts. Thanks

enter image description here

vs.

enter image description here

I see. Very cool!

It seems you may be able to put your fonts in ~/.fonts and it will be available?

Hi Conrad,

I just wanted to comment here in here in case it might be helpful in general. Putting a font file in ~/.fonts will make the font appear when fc-list is run (after running fc-cache), but it may still not be available for individual components, e.g. matplotlib. For the case of mpl, I had to update the fontList.json file ~/.cache/matplotlib.

I think the default location for fonts for the linux OS pythonanywhere is running is /usr/share/fonts, but since this is inaccessible to the user, I would guess custom font files would have to configured manually for each component. I believe the default location for fonts isn't ~/.fonts. Please correct me if this is wrong.

Thanks

The link that conrad posted also suggested that .local/share/fonts may be a possibility.

Correct, but the link also suggested that these paths may depend on the version of the linux OS. I will try the .local path for fonts in the near future and report back if I find something of relevance for PA users.