Skip to content

Instantly share code, notes, and snippets.

@mekkablue
Last active August 11, 2022 09:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mekkablue/11179587 to your computer and use it in GitHub Desktop.
Save mekkablue/11179587 to your computer and use it in GitHub Desktop.
Creating an Isopsephy OT feature
alphabet = list( "abcdefghijklmnopqrstuvwxyz" )
alphabetLength = len(alphabet)
wordlength = 5
figures = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
def wordForNumber( thisNumber ):
figurelist = [ figures[int( x )] for x in str( thisNumber ) ]
return "_".join( figurelist )
def lookupWithContent( lookupName, content ):
returnstring = "lookup %s {\n" % lookupName
returnstring += content
returnstring += "} %s;\n" % lookupName
return returnstring
firstLookup = ""
for i in range( alphabetLength ):
firstLookup += "\tsub %s by %s;\n" % ( alphabet[i], wordForNumber(i+1) )
print lookupWithContent( "INIT", firstLookup )
for factor in range(wordlength):
consecutiveLookup = ""
for i in range( factor, alphabetLength * (factor+1) ):
for j in range( alphabetLength ):
consecutiveLookup += "\tsub %s %s by %s;\n" % ( wordForNumber(i+1), wordForNumber(j+1), wordForNumber(i+j+2) )
print lookupWithContent( "STEP_%i" % (factor+1), consecutiveLookup )
print "# CMD-SHIFT-G with these glyph names:"
print "#",
for i in range( 9, (wordlength+1) * alphabetLength ):
print wordForNumber(i+1),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment