Skip to content

Instantly share code, notes, and snippets.

@connordavenport
Last active May 10, 2022 20:33
Show Gist options
  • Save connordavenport/324fe2bc93be43db21a2a932f0a3586f to your computer and use it in GitHub Desktop.
Save connordavenport/324fe2bc93be43db21a2a932f0a3586f to your computer and use it in GitHub Desktop.
Bring a font to the front
# menuTitle : front & center
# shortCut : command+alt+0
from mojo.UI import SelectFont, AllFontWindows
from fontParts.world import RFont
class frontAndCenter:
def __init__(self):
self.fontWindows = [(w.document.font,w) for w in AllFontWindows() if hasattr(w, "document")]
self.font = SelectFont()
self.bringUp()
def bringUp(self):
for font, win in self.fontWindows:
f = RFont(font)
if f == self.font:
win.w.getNSWindow().makeKeyAndOrderFront_(None)
frontAndCenter()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment