Shortcut to toggle "To" — the on/off kerning

Hi,
I’m sure that this has been asked before, maybe I’m not sure what its name that’s why I cannot find the answer. Do you have a way to set the shortcut to toggle “To” button at the bottom right?

Many thanks!
CleanShot 2023-12-16 at 14.32.13

There is no direct way. But you can put that code in a script and assign a keyboard shortcut:

tab = Font.currentTab
graphicView = tab.graphicView()
graphicView.setDoKerning_(False)
graphicView.setDoSpacing_(True)
tab.updateKerningButton()
graphicView.reflow()
tab.updatePreview()
1 Like

Thank you for your help!

Hi, I’m trying to make the toggle through all three stages, however I think I’m missing something here — “allowing to do both kerning and spacing” stage doesn’t work. In case you have any advice?

#MenuTitle: Toggle To
__doc__="""
Toggle 3 stages of "To" icon, kerning
"""
tab = Font.currentTab
graphicView = tab.graphicView()
#help(graphicView)
if graphicView.doKerning():
	#no kerning show	
	graphicView.setDoSpacing_(True)
	graphicView.setDoKerning_(False)
	print("1")
elif graphicView.doSpacing():
	#lock
	graphicView.setDoSpacing_(False)
	graphicView.setDoKerning_(True)
	print("2")
else:
	graphicView.setDoSpacing_(True)
	graphicView.setDoKerning_(True)
	print("3")

tab.updateKerningButton()
graphicView.reflow()
tab.updatePreview()

Found the solution

#MenuTitle: Toggle To
__doc__="""
Toggle 3 stages of "To" icon, kerning
"""
tab = Font.currentTab
graphicView = tab.graphicView()

if graphicView.doSpacing() and graphicView.doKerning():
    # now, only spacing is allowed
    # graphicView.setDoSpacing_(True)  # already True, so don’t need to set it
    graphicView.setDoKerning_(False)
    print('1')
elif graphicView.doSpacing() and not graphicView.doKerning():
    # now, things are locked
    graphicView.setDoSpacing_(False)
    graphicView.setDoKerning_(True)
    print('2')
else:
    # now, only kerning is allowed
    graphicView.setDoSpacing_(True)
    graphicView.setDoKerning_(True)
    print('3')


tab.updateKerningButton()
graphicView.reflow()
tab.updatePreview()
1 Like