How to run a python script to generate fonts

Hey all-

Currently working with fabGL & need a larger font than what is included. Fortunately the author included a tool for converting ttf fonts to a header file compatible with the library.

Unfortunately, the tool is a python script & I know nothing about python..I mean nothing. Well I know its installed on my system as its been a prerequisite for other software, but I've never directly used it. The author even gives example command lines, but I'm so green I dont even know where to type them.

here are the instructions:

Usage:
  python3 ttf2header.py filename size [-s stroke] [-o output_filename] [-r firstindex lastindex]

Examples:

 - create file Arial24.h, size 24, indexes 0 to 255
     python3 ttf2header.py Arial.ttf 24

 - create file Arial44.h, size 44, indexes 0 to 255, not filled with line width 1
     python3 ttf2header.py Arial.ttf 44 -s 1

The only think I could think to try was to locate all the files in an easy directory & then run the command thought a command line. It seemed to take the command (no errors) but it did nothing. So where am I suppose to run this from? Thanks all!

all of the documentation for fabgl can be found here: FabGL: FabGL Library

Did it do nothing nothing or did it create the Arial24.h file?...
What exactly did you type into your command line?

my font has a different file name, but it didn't generate any files, or really appear to do anything.

my font file is called "datactr.ttf"

I located the script & font file all in "c:\fonts" navigated to there and ran:

python3 ttf2header.py datactr.ttf 24

I think I need to clarify I did this in a windows terminal (thats wrong, right?), I see now that there is also a python terminal...I'm -guessing- thats where I should be running it, but I don't even know how to navigate to the right folder.

Correct wrong.

You need to type this in the command line, not the Python terminal.

oh, interesting. so I was doing it right. hmmm...so my line should have worked, no?

just tried as admin, no diff, nothing happens

well I was literally typing the "python3" in the command line, I though it was part of the command. :man_facepalming: :rofl: (it is odd (to me) that it was accepting my command with the leading "phython3"...whats up with that?

Once I figured out that shouldn't be there, the command started returning an error. So I traced that back the script itself, where I found a note that I needed to run "pip3 install Pillow" to install this Pillow thing(no idea what that actually is). Once installed, ran the line, script ran & made the file!

Thanks for the help, this one is case closed.

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