How to create a Turing font

If you want to use your own substitution method and/or another font (different that the ones provided in the Downloads section) you will need to create your own Turing's font.

The first thing that you need to do is to define your plain text alphabet and your cipher text alphabet, which define which letters are going to be substituted and with which values.

For example, in ROT13 the plain text alphabet is "abcdefghijklmnopqrstuvwxyz" and the cipher text alphabet is "nopqrstuvwxyzabcdefghijklm", indicating that the letter 'A' is going to be substituted by 'N', the letter 'B' by 'O', etc.

The next thing to do is to define a font that inverses the substitutions. For example, if ROT13 is used, the font must indicate to draw an 'A' when the letter 'N' is found, draw a 'B' when encountering an 'O', etc.

One way to do this is to use scripting capabilities of the application FontForge.

Using FontForge

In order to use FontForge to create a Turing font, first must you replace, in the following script, the path of the font to modify, the alphabets that you want to use and (optionally) the name of the new font.

# Load module
import fontforge

# Get the font to be modified
myFont = fontforge.open("C:\MyFonts\Arial.ttf")

# Define the text and plain alphabets to use
plain = "abcdefghijklmnopqrstuvwxyz"
cipher = "zyxwvutsrqponmlkjihgfedcba"

# Define the name of the new font.
newFontName = myFont.fontname + "-" + cipher

# Create a font to use as auxiliar variable
temporal = fontforge.font()
	
# Change the order of the letters
plain = plain + plain.upper()
cipher = cipher + cipher.upper()
for i in range(len(plain)):
    myFont.selection.select( plain[i] )
    myFont.copy()                                   
    temporal.selection.select( cipher[i] )
    temporal.paste()

# Copy back the letters in the auxiliar font to the original font.
temporal.selection.select(("ranges",None),"a","z")
myFont.selection.select(("ranges",None),"a","z")
temporal.copy()
myFont.paste()
temporal.selection.select(("ranges",None),"A","Z")
myFont.selection.select(("ranges",None),"A","Z")
temporal.copy()
myFont.paste()

# Save new font
myFont.fontname = newFontName
myFont.familyname = newFontName
myFont.fullname = newFontName
myFont.save(newFontName + ".sfd")
temporal.close()

Then you execute this script in FontForge, by selecting the option File and then Execute script...

After a few seconds, the font is going to be generated and you are going to be able to exported to TTF or any other format supported by the application.

Fork me on GitHub