Search code examples
truetype

create .ttf (true type font) file programmatically


I'm interested in creating my own .ttf file using my own code. I did some research and found Apple's specification for .ttf files. I'm having trouble understanding it though. Here is an excerpt:

"A TrueType font file consists of a sequence of concatenated tables. A table is a sequence of words. Each table must be long aligned and padded with zeroes if necessary." https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6.html

I opened up a .ttf file with notepad++, expecting to see the tables described above, but just got a bunch of incomprehensible stuff. See attached screenshot.

Screenshot

My question: What are these tables?

Can anybody expand on what I need to do to create these tables? I'm newer to writing code, so maybe the problem is my lack of coding knowledge. If that's the case, could someone point me to a reference where I can educate myself on these tables?


Solution

  • I found the answer to my question:

    http://www.fileformat.info/tool/hexdump.htm

    I uploaded a .ttf file here and the site converted it to hexadecimal form to display. Now i can read the .ttf specification in one window and have an example of the spec being implemented up in another.

    Originally i was looking for a binary display, but this hex display is much better for viewing.

    Using this hex dump along with the .ttx file makes the .ttf file format a LOT more understandable.

    Update:

    I found another answer. There's a python package called 'ufo-extractor' that converts .otf or .ttf files into .ufo files. A .ufo file is a human readable font file. See: http://unifiedfontobject.org/