Created
August 17, 2022 18:56
-
-
Save benkiel/0065bc0746db189422e800c47918c1ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from vanilla import Window, EditText, TextBox | |
from defconAppKit.controls.fontInfoView import postscriptStemSnapToUFO, infoListFromUFO | |
from mojo.subscriber import Subscriber, WindowController, registerCurrentFontSubscriber | |
class Stems(Subscriber, WindowController): | |
def build(self): | |
self.w = Window((250, 70)) | |
self.w.vStemsControl = EditText((60, 10, -10, 20), callback=self.editVCallback) | |
self.w.vStemsLabel = TextBox((10, 10, -10, 17), "vStems") | |
self.w.hStemsControl = EditText((60, 40, -10, 20), callback=self.editHCallback) | |
self.w.hStemsLabel = TextBox((10, 40, -10, 17), "hStems") | |
def started(self): | |
self.w.open() | |
def currentFontDidSetFont(self, info): | |
font = info["font"] | |
if font is not None: | |
self.font = font | |
self.w.vStemsControl.set(infoListFromUFO(font.info.postscriptStemSnapV)) | |
self.w.hStemsControl.set(infoListFromUFO(font.info.postscriptStemSnapH)) | |
def editVCallback(self, sender): | |
self.font.info.postscriptStemSnapV = postscriptStemSnapToUFO(sender.get()) | |
def editHCallback(self, sender): | |
self.font.info.postscriptStemSnapH = postscriptStemSnapToUFO(sender.get()) | |
registerCurrentFontSubscriber(Stems) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment