An online solution which generates thumbnails of fonts

For ages now I have collected various digital media (images, videos, fonts, templates, html, etc.) It’s all on some external drive, but I would like to upload them so I can access it whenever. I have tried Filerun (using it), ResourceSpace (it consistently just dies on me), Omeka, and of course NextCloud (which always has been too buggy).

What I’m looking for is a solution which will generate thumbnails for any of the uploaded media. Particularly, fonts (ttf, otf). For the most part the above apps do so (in addition to their various bugginess), just not with fonts. I’ve viewed a few in a font manager and then screenshot the preview, but that is a hassle to then find the screenshot, rename it, then move it to the right level in the font folder, etc. The closest I found is Omeka which allows a user to specify what media to display, and even when uploading a font it will tell me “No permission for x-font-otf,application”, helpfully telling me what it is so I can add it to the list of displayable media. But it isn’t working. Help on their forums hasn’t really led me to a solution (yet).

Is there some niche software that could help me? I love FileRun and use it, I like just uploading, refreshing, and the media is there. Nextcloud has so much hype I keep going back to it but holy smokes it is always slow and buggy. ResourceSpace changed its licencing so the open source version is a little clunky and consistently ends of having strange SSL or routing problems and simply doesn’t load.

Well,

I am continuously poking around, trying to find solutions, and came across a mention of fontpreviewer.py in a list of related GitHub projects.

I read it, downloaded it, cd’ed to the directory, and ran ./fontpreviewer.py /directory/of/font but received an error message,

SyntaxError: Missing parentheses in call to 'print'

That led to more Googling, ultimately to this: https://stackoverflow.com/questions/25445439/what-does-syntaxerror-missing-parentheses-in-call-to-print-mean-in-python. Apparently the print command from python 2 differs from python3.

Now, as you know, I’m not a programmer, so I was thinking where in the world do I even start? which python didn’t return anything. I even emailed the creator at their gmail address! But looking at it again I thought, ok, python3 needs an opening and closing parenthesis around the python print command… let’s try it. The error messaged indicated where the lines in question were, so I went there and added the parentheses, and ran it again. Got the same error but for different lines. So I added the parentheses there, too. Ran it again and got an error that pygame isn’t installed. OK.

Google it. A few sites later this one seemed useful and straightforward. But I kept getting this error: error: externally-managed-environment. When it rains, it pours! I had to try to use pip to install pygame, but I don’t use pip, I use pip3. (Don’t ask me how this happened. I think while installing Jekyll I followed some tutorial and ended up using brew to install python3, and pip3 and even pipx.) A SO post suggested I just add –break-system-packages to the command, and well, I don’t really have a system, per se, to break. So I added that to the command that now looks like this: pip3 install pygame --break-system-packages, and voila,

Collecting pygame
  Downloading pygame-2.5.2-cp312-cp312-macosx_10_9_x86_64.whl.metadata (13 kB)
Downloading pygame-2.5.2-cp312-cp312-macosx_10_9_x86_64.whl (13.0 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.0/13.0 MB 4.7 MB/s eta 0:00:00
Installing collected packages: pygame
Successfully installed pygame-2.5.2

Is my System borked? Who knows. I imagine I will eventually go to install something else and get an error related to this.

Well, now it works.

./fontpreviewer.py -s 48 -a /Users/USER/Downloads/FONTS/antonio/Antonio-Bold.ttf
pygame 2.5.2 (SDL 2.28.3, Python 3.12.2)
Hello from the pygame community. https://www.pygame.org/contribute.html

And in the /Users/USER/Downloads/FONTS/antonio/ folder there is a nice Antonio-Bold.png. Here is what it looks like:

So for now, one aspect of my problem has a sort-of solution — a thumbnail showing what the font looks like. I can even change the text so it shows names or more pertinent text. Previously I would select the font file, press the Spacebar, and then Command+4 to get a screenshot like this:

But then I’d have to find the screenshot, rename it, and then move it back to the font folder. A few too many steps.

I would still prefer an online self-hostable solution that will do this for me, but in the meantime this is a slightly better thumbnail generation option.

For the curious, here are my tabs during this endeavour. I closed a bunch that didn’t seem helpful.

If you want to what solutions are suggested, you can check out this post on the Cloudron forums.