コード例 #1
0
    def __init__(self):

        self.pageScale = 0.1  # Scale the SVG so that glyphs aren't 1000 ps points in size
        self.bufferFactor = 3  # The scale of the buffer within the grid (1 = glyphs touch)

        self.fontList = []
        self.fontNameList = []

        if not HASDRAWBOT:

            self.w = vanilla.Window((300, 200), "Import/Export Art")

            self.w.title = vanilla.TextBox((10, 10, -10, 25), titleText)
            self.w.warningBox = vanilla.Box((10, 40, -10, 150))
            self.w.warningBox.nodrawbot = vanilla.TextBox((10, 10, -10, -10),
                                                          nodrawbotText)
            self.w.open()

        else:

            self.w = vanilla.Window((300, 780), "Import/Export Art")

            self.w.title = vanilla.TextBox((10, 10, -10, 25), titleText)
            self.w.titleFont = vanilla.TextBox((10, 40, -10, 25),
                                               "Source/Destination UFO")
            self.w.fontChoice = vanilla.PopUpButton((10, 60, -10, 25),
                                                    self.fontNameList)
            # Export
            self.w.exportBox = vanilla.Box((10, 105, -10, 185))
            self.w.exportBox.title = vanilla.TextBox((10, 10, -10, 100),
                                                     descriptionExport)
            self.w.exportBox.glyphChoice = vanilla.PopUpButton(
                (10, 110, -10, 25), ["Selected glyphs", "All glyphs"])
            self.w.exportBox.exportButton = vanilla.SquareButton(
                (10, 140, -10, 25), "Export SVG", callback=self.exportCallback)
            # Edit
            self.w.editBox = vanilla.Box((10, 305, -10, 165))
            self.w.editBox.title = vanilla.TextBox((10, 10, -10, 200),
                                                   descriptionEdit)
            # Import
            self.w.importBox = vanilla.Box((10, 485, -10, 285))
            self.w.importBox.title = vanilla.TextBox((10, 10, -10, 190),
                                                     descriptionImport)
            self.w.importBox.layerChoice = vanilla.PopUpButton(
                (10, 210, -10, 25), [
                    "Into the default foreground layer",
                    "Into a new layer called “import“"
                ])
            self.w.importBox.importButton = vanilla.SquareButton(
                (10, 240, -10, 25), "Import SVG", callback=self.importCallback)

            self.w.bind("close", self.closeCallback)
            self.w.open()
            self.buildFontList(None)

            addObserver(self, "buildFontList", "fontDidOpen")
            addObserver(self, "buildFontList", "newFontDidOpen")
            addObserver(self, "buildFontList", "fontDidClose")
コード例 #2
0
    def __init__(self):
        self.w = vanilla.FloatingWindow(
            (400, 80),
            "Replace Components in Selection",
            minSize=(400, 80),
            maxSize=(500, 80),
            autosaveName="com.mekkablue.ReplaceComponents.mainwindow")

        self.w.textReplace = vanilla.TextBox((15, 12 + 2, 65, 14),
                                             "Replace",
                                             sizeStyle='small')
        self.w.componentName = vanilla.PopUpButton((65, 12, 80, 17),
                                                   self.GetComponentNames(),
                                                   sizeStyle='small')
        self.w.resetComponentName = vanilla.SquareButton(
            (65 + 80 + 10, 12, 20, 18),
            u"↺",
            sizeStyle='small',
            callback=self.SetComponentNames)

        self.w.textBy = vanilla.TextBox((65 + 80 + 40, 12 + 2, 25, 14),
                                        "by",
                                        sizeStyle='small')
        self.w.componentNewName = vanilla.EditText(
            (65 + 80 + 40 + 30, 12, -120, 19),
            "glyph.alt",
            sizeStyle='small',
            callback=self.SavePrefs)
        self.w.resetComponentNewName = vanilla.SquareButton(
            (-110, 12, -90, 18),
            u"↺",
            sizeStyle='small',
            callback=self.ResetComponentNewName)

        self.w.includeAllLayers = vanilla.CheckBox((15 + 3, 35, -15, 18),
                                                   "Include all layers",
                                                   value=True,
                                                   sizeStyle='small',
                                                   callback=self.SavePrefs)

        self.w.replaceButton = vanilla.Button((-80, 12 + 1, -15, 17),
                                              "Replace",
                                              sizeStyle='small',
                                              callback=self.ButtonCallback)
        self.w.setDefaultButton(self.w.replaceButton)

        if not self.LoadPrefs():
            print "Note: Could not load preferences. Will resort to defaults."

        self.w.open()
コード例 #3
0
    def __init__(self):
        # Window 'self.w':
        hMargin = 10
        vMargin = 15
        textWidth = 250
        textHeight = 14 * 2
        buttonWidth = 90
        buttonHeight = 20

        windowWidth = buttonWidth * 3 + hMargin * 4
        windowHeight = textHeight + buttonHeight + vMargin * 3
        windowWidthResize = 100  # user can resize width by this value
        windowHeightResize = 0  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Remove Kern Groups",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
        )

        # UI elements:
        self.w.text_1 = vanilla.TextBox(
            (hMargin, vMargin, textWidth, textHeight),
            "Remove Kern Groups on the left, right or both sides of the selected glyphs.",
            sizeStyle='small')
        self.w.button_1 = vanilla.SquareButton(
            (hMargin, vMargin + textHeight + vMargin, buttonWidth,
             buttonHeight),
            u"Left Groups",
            sizeStyle='small',
            callback=self.removeLeft)
        self.w.button_2 = vanilla.SquareButton(
            (hMargin + buttonWidth + hMargin, vMargin + textHeight + vMargin,
             buttonWidth, buttonHeight),
            u"Both Groups",
            sizeStyle='small',
            callback=self.removeBoth)
        self.w.button_3 = vanilla.SquareButton(
            (hMargin + buttonWidth + hMargin + buttonWidth + hMargin,
             vMargin + textHeight + vMargin, buttonWidth, buttonHeight),
            u"Right Groups",
            sizeStyle='small',
            callback=self.removeRight)

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
コード例 #4
0
    def __init__(self):

        self.fontList = AllFonts()
        self.fontNames = [str(f) for f in self.fontList]

        self.w = vanilla.Window((300, 220), "Copy Anchors")
        self.w.fontChoiceTitle0 = vanilla.TextBox((10, 14, -10, 25), "⬇️")
        self.w.fontChoice0 = vanilla.PopUpButton((40, 10, -10, 25),
                                                 self.fontNames)
        self.w.fontChoiceTitle1 = vanilla.TextBox((10, 44, -10, 25), "➡️")
        self.w.fontChoice1 = vanilla.PopUpButton((40, 40, -10, 25),
                                                 self.fontNames)
        if len(self.fontNames) > 1:
            self.w.fontChoice1.set(1)

        self.w.glyphTitle = vanilla.TextBox((10, 84, -10, 25), "🔠")
        self.w.glyphChoice = vanilla.PopUpButton(
            (40, 80, -10, 25), ["Selected glyphs", "All glyphs"])

        self.w.measureTitle = vanilla.TextBox((10, 114, -10, 25), "↔️")
        self.w.measureChoice = vanilla.PopUpButton(
            (40, 110, -10, 25), ["Relative to glyph bounds", "Exact copy"])

        self.w.clearFist = vanilla.CheckBox((40, 145, -10, 25),
                                            "Clear destination anchors first",
                                            value=True)

        self.w.copyButton = vanilla.SquareButton((10, 185, -10, 25),
                                                 "Copy!",
                                                 callback=self.copyAnchors)
        self.w.open()
コード例 #5
0
	def __init__( self ):
		self.w = vanilla.FloatingWindow( (330, 170), "Anchor Mover 2.0", minSize=(300,170), maxSize=(1000,170), autosaveName="com.mekkablue.AnchorMover2.mainwindow" )

		self.w.text_1 = vanilla.TextBox((15-1, 12+2, 75, 14), "Move anchor", sizeStyle='small' )
		self.w.anchor_name = vanilla.PopUpButton((15+75, 12, -110-15-25, 17), self.GetAnchorNames(), sizeStyle='small' )
		self.w.button = vanilla.SquareButton((-110-15-20, 12, -110-15, 18), u"↺", sizeStyle='small', callback=self.SetAnchorNames )
		self.w.text_2 = vanilla.TextBox((-105-15, 12+2, -15, 14), "in selected glyphs:", sizeStyle='small' )
		
		self.w.hLine_1 = vanilla.HorizontalLine((15, 40, -15, 1))
		self.w.hText_1 = vanilla.TextBox((15-2, 40+12, 20, 14), u"↔", sizeStyle='regular' )
		self.w.hText_2 = vanilla.TextBox((15+20, 40+12+2, 20, 14), "to", sizeStyle='small' )
		self.w.hTarget = vanilla.PopUpButton((15+40, 40+12, -50-15-15-15, 17), [x[0] for x in listHorizontal], sizeStyle='small', callback=self.SavePreferences )
		self.w.hText_3 = vanilla.TextBox((-60-15-15, 40+12+2, -50-15, 14), "+", sizeStyle='small' )
		self.w.hChange = vanilla.EditText((-60-15, 40+12, -15, 19), "0.0", sizeStyle='small', callback=self.SavePreferences )
		
		self.w.vText_1 = vanilla.TextBox((15, 70+12, 20, 14), u"↕", sizeStyle='regular' )
		self.w.vText_2 = vanilla.TextBox((15+20, 70+12+2, 20, 14), "to", sizeStyle='small' )
		self.w.vTarget = vanilla.PopUpButton((15+40, 70+12, -50-15-15-15, 17), [y[0] for y in listVertical], sizeStyle='small', callback=self.SavePreferences )
		self.w.vText_3 = vanilla.TextBox((-60-15-15, 70+12+2, -50-15, 14), "+", sizeStyle='small' )
		self.w.vChange = vanilla.EditText((-60-15, 70+12, -15, 19), "0.0", sizeStyle='small', callback=self.SavePreferences )
		
		self.w.italic  = vanilla.CheckBox((15, 110, -15, 18), "Respect italic angle", value=True, sizeStyle='small', callback=self.SavePreferences )
		
		self.w.moveButton = vanilla.Button((-80-15, -20-15, -15, -15), "Move", sizeStyle='regular', callback=self.MoveCallback )
		self.w.setDefaultButton( self.w.moveButton )

		if not self.LoadPreferences( ):
			print "Error: Could not load preferences. Will resort to defaults."

		self.w.open()
コード例 #6
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 240
		windowHeight = 110
		windowWidthResize  = 300 # user can resize width by this value
		windowHeightResize = 0   # user can resize height by this value
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Remove Anchors", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.AnchorDeleter.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		linePos, inset, lineHeight = 12, 15, 22
		self.w.text_1 = vanilla.TextBox( (inset-1, linePos+2, 80, 14), "Delete anchor", sizeStyle='small' )
		self.w.updateButton = vanilla.SquareButton( (-inset-20, linePos, -inset, 18), u"↺", sizeStyle='small', callback=self.updateAnchors )
		self.w.anchorPopup = vanilla.PopUpButton( (inset+80, linePos, -inset-25, 17), self.updateAnchors(None), callback=self.SavePreferences, sizeStyle='small' )
		
		linePos += lineHeight
		self.w.selectedAnchorsOnly = vanilla.CheckBox( (inset, linePos, -inset, 20), "In selected glyphs only", value=False, callback=self.SavePreferences, sizeStyle='small' )

		# Run Button:
		self.w.runButton = vanilla.Button((-80-inset, -20-inset, -inset, -inset), "Delete", sizeStyle='regular', callback=self.AnchorDeleterMain )
		self.w.setDefaultButton( self.w.runButton )
		
		# Load Settings:
		if not self.LoadPreferences():
			print "Note: 'Delete Anchors' could not load preferences. Will resort to defaults"
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
コード例 #7
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 400
        windowHeight = 160
        windowWidthResize = 1000  # user can resize width by this value
        windowHeightResize = 1000  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Compare Glyph Info",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.CompareGlyphInfo.mainwindow"  # stores last window position and size
        )

        # UI elements:
        self.linePos, inset, lineHeight = 5, 6, 22

        self.w.descriptionText = vanilla.TextBox(
            (inset, self.linePos + 2, 140, 14),
            "Compare between fonts:",
            sizeStyle='small',
            selectable=True)

        self.w.whatToCompare = vanilla.PopUpButton(
            (inset + 140, self.linePos, -160 - inset - 10, 17),
            thingsToCompare,
            sizeStyle='small',
            callback=self.Reload)
        self.w.whatToCompare.getNSPopUpButton().setToolTip_(
            "Choose which glyph info to compare between all open fonts.")

        self.w.ignoreMissingGlyphs = vanilla.CheckBox(
            (-160 - inset, self.linePos, -inset - 25, 17),
            "Ignore missing glyphs",
            value=False,
            callback=self.Reload,
            sizeStyle='small')
        self.w.ignoreMissingGlyphs.getNSButton().setToolTip_(
            "If activated, will only list glyphs that are present in ALL open fonts."
        )

        self.w.updateButton = vanilla.SquareButton(
            (-inset - 20, self.linePos, -inset, 18),
            "↺",
            sizeStyle='small',
            callback=self.Reload)
        self.w.updateButton.getNSButton().setToolTip_(
            "Reload with currently opened fonts. Useful if you just opened or closed a font, or brought another font forward."
        )

        self.linePos += lineHeight
        self.Reload()

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
コード例 #8
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 300
		windowHeight = 170
		windowWidthResize  = 500 # user can resize width by this value
		windowHeightResize = 0   # user can resize height by this value
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Position Clicker", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.PositionClicker.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		linePos, inset, lineHeight, indent = 12, 15, 22, 100

		self.w.descriptionText = vanilla.TextBox( (inset, linePos, -inset, 14), "Report positional combos that do not click:", sizeStyle='small', selectable=True )
		self.w.descriptionText.getNSTextField().setToolTip_("Clicking means that when two matching positional shapes follow each other (e.g. initial and final), they ‘click’, i.e., they share at least 2 point coordinates. Or whatever number is set in the minimal node count setting below.")
		linePos += lineHeight
		
		tooltip = "Reference glyph. Pick a medial glyph with paths for clicking. We recommend behDotless-ar.medi."
		self.w.referenceText = vanilla.TextBox( (inset, linePos+2, indent, 14), "Click with glyph", sizeStyle='small', selectable=True )
		self.w.referenceText.getNSTextField().setToolTip_(tooltip)
		
		self.w.referenceGlyphName = vanilla.ComboBox( (inset+indent, linePos-4, -inset-23, 25), self.getAllMediGlyphNames(), callback=self.SavePreferences, sizeStyle='regular' )
		self.w.referenceGlyphName.getNSComboBox().setFont_(NSFont.userFixedPitchFontOfSize_(11))
		self.w.referenceGlyphName.getNSComboBox().setToolTip_(tooltip)
		
		self.w.updateButton = vanilla.SquareButton( (-inset-20, linePos-1, -inset, 18), "↺", sizeStyle='small', callback=self.updateReferenceGlyphs )
		self.w.updateButton.getNSButton().setToolTip_("Update the list in the combo box with all .medi glyphs in the frontmost font.")
		linePos += lineHeight
		
		tooltip = "The amount of point coordinates that must be shared between two consecutive positional forms. E.g., if set to 2, an initial and a final shape must have two or more nodes exactly on top of each other when they follow each other."
		self.w.clickCountText = vanilla.TextBox( (inset, linePos+2, indent, 14), "Minimal node count", sizeStyle='small', selectable=True )
		self.w.clickCount = vanilla.EditText( (inset+indent, linePos-1, -inset, 19), "2", callback=self.SavePreferences, sizeStyle='small' )
		linePos += lineHeight
		
		self.w.includeNonExporting = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Include non-exporting glyphs", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.includeNonExporting.getNSButton().setToolTip_("Will also measure glyphs that are set to not export.")
		linePos += lineHeight
		
		self.w.reuseTab = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Reuse current tab", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.reuseTab.getNSButton().setToolTip_("Will use the current tab for output. Will open a new tab only if there is no Edit tab open already.")
		linePos += lineHeight
		
		# Run Button:
		self.w.runButton = vanilla.Button( (-100-inset, -20-inset, -inset, -inset), "Open Tab", sizeStyle='regular', callback=self.PositionClickerMain )
		self.w.setDefaultButton( self.w.runButton )
		
		# Load Settings:
		if not self.LoadPreferences():
			print("Note: 'Position Clicker' could not load preferences. Will resort to defaults")
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
コード例 #9
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 380
		windowHeight = 155
		windowWidthResize  = 300 # user can resize width by this value
		windowHeightResize = 0   # user can resize height by this value
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Populate Layer Backgrounds with Component", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.PopulateAllBackgroundswithComponent.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		linePos, inset, lineHeight = 10, 15, 22
		
		self.w.descriptionText = vanilla.TextBox( (inset, linePos+2, -inset, 14), 
			"In selected glyphs, insert component in all layer backgrounds:", 
			sizeStyle='small', selectable=True )
		linePos += lineHeight
		
		self.w.text_1 = vanilla.TextBox( (inset-1, linePos+2, 100, 14), "Add component:", sizeStyle='small' )
		self.w.componentName = vanilla.EditText( (inset+100, linePos, -inset-25, 19), "a", sizeStyle='small', callback=self.SavePreferences)
		self.w.componentName.getNSTextField().setToolTip_("Name of the glyph that should be inserted as component in the background of all layers of the selected glyph(s).")
		self.w.updateButton = vanilla.SquareButton( (-inset-20, linePos, -inset, 18), u"↺", sizeStyle='small', callback=self.update )
		self.w.updateButton.getNSButton().setToolTip_("Guess the component name. Hold down OPTION to ignore the suffix.")
		linePos += lineHeight
		
		self.w.alignRight = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Align with right edge of layer", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.alignRight.getNSButton().setToolTip_("Right-aligns the component width with the layer width. Useful for the e in ae or oe, for example.")
		linePos += lineHeight
		
		self.w.replaceBackgrounds = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Replace existing backgrounds", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.replaceBackgrounds.getNSButton().setToolTip_("Deletes existing background content before it inserts the component. Recommended if you want to align selected nodes with the background.")
		linePos += lineHeight
		
		# Run Button:
		self.w.runButton = vanilla.Button( (-100-inset, -20-inset, -inset, -inset), "Populate", sizeStyle='regular', callback=self.PopulateAllBackgroundswithComponentMain )
		self.w.runButton.getNSButton().setToolTip_("Inserts the specified component in ALL layers of the current glyph(s).")
		self.w.setDefaultButton( self.w.runButton )
		
		self.w.alignButton = vanilla.Button( (-220-inset, -20-inset, -110-inset, -inset), "Align Nodes", sizeStyle='regular', callback=self.AlignNodesMain )
		self.w.alignButton.getNSButton().setToolTip_("Aligns selected nodes with the (original) nodes in the background components. Only does this on the CURRENT layer.")
		
		self.w.nextMasterButton = vanilla.Button( (-340-inset, -20-inset, -230-inset, -inset), "Next Master", sizeStyle='regular', callback=self.NextMasterMain )
		self.w.nextMasterButton.getNSButton().setToolTip_("Switches the current tab to the next master. Useful if you want to align the same nodes in every master.")
		
		# Load Settings:
		if not self.LoadPreferences():
			print("Note: 'Populate All Backgrounds with Component' could not load preferences. Will resort to defaults")
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
コード例 #10
0
	def __init__( self):
		# Window 'self.w':
		windowWidth  = 400
		windowHeight = 80
		windowWidthResize  = 200 # user can resize width by this value
		windowHeightResize = 0   # user can resize height by this value
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Replace Components in Selection", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.ReplaceComponents.mainwindow" # stores last window position and size
		)

		# UI elements:
		linePos, inset, lineHeight = 10, 15, 22
		
		self.w.textReplace = vanilla.TextBox((inset, linePos+2, inset+50, 14), "Replace", sizeStyle='small')
		self.w.componentName = vanilla.PopUpButton((inset+50, linePos, 100, 17), self.GetComponentNames(), sizeStyle='small')
		self.w.componentName.getNSPopUpButton().setToolTip_(u"The name of the component you want to replace. If it is not shown here, make a glyph selection and press the ↺ Update button. This will populate the menu with the names of all components in selected glyphs.")
		self.w.resetComponentName = vanilla.SquareButton((inset+50+100+5, linePos, 20, 18), u"↺", sizeStyle='small', callback=self.SetComponentNames )

		self.w.textBy = vanilla.TextBox((inset+50+100+35, linePos+2, 20, 14), "by", sizeStyle='small')
		# self.w.componentNewName = vanilla.EditText((65+100+35+25, linePos, -inset-95, 19), "", sizeStyle='small', callback=self.SavePreferences)
		self.w.componentNewName = vanilla.ComboBox( (65+100+35+25, linePos-1, -inset-95, 19), self.getAllGlyphNamesOfFrontmostFont(), sizeStyle='small', callback=self.SavePreferences )
		self.w.componentNewName.getNSComboBox().setToolTip_(u"The name of the component you want to insert instead of the component chosen in the menu.")
		self.w.resetComponentNewName = vanilla.SquareButton((-inset-90, linePos, -inset-70, 18), u"↺", sizeStyle='small', callback=self.ResetComponentNewName )
		self.w.replaceButton = vanilla.Button((-inset-60, linePos+1, -inset, 17), "Replace", sizeStyle='small', callback=self.FindAndReplaceMain )
		self.w.setDefaultButton( self.w.replaceButton )

		linePos += lineHeight
		
		self.w.includeAllLayers = vanilla.CheckBox((inset, linePos, 120, 18), "Include all layers", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.includeAllLayers.getNSButton().setToolTip_(u"If checked, will not only treat visible selected layers, but ALL (master, special and backup) layers of all selected glyphs.")
		self.w.includeBackgrounds = vanilla.CheckBox( (inset+120, linePos, -inset, 20), u"Include backgrounds", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.includeBackgrounds.getNSButton().setToolTip_(u"If checked, will also go through backgrounds of all treated layers.")
		linePos += lineHeight
		
		if not self.LoadPreferences( ):
			print("⚠️ Note: Could not load preferences. Will resort to defaults.")

		self.w.open()
コード例 #11
0
 def __init__(self):
     self.w = vanilla.FloatingWindow((175, 235), "Warp Starter")
     step = 10
     self.w.decomposeAllButton = vanilla.SquareButton(
         (10, step, -10, 25),
         "Decomp/Deoverlap All",
         sizeStyle="small",
         callback=self.doDecompose)
     self.w.decomposeAllButton.id = "all"
     step += 30
     self.w.decomposeSomeButton = vanilla.SquareButton(
         (10, step, -10, 25),
         "Decomp/Deverlap Mixed",
         sizeStyle="small",
         callback=self.doDecompose)
     self.w.decomposeSomeButton.id = "mixed"
     step += 30
     self.w.curveButton = vanilla.SquareButton((10, step, -10, 25),
                                               "Flat to Curve Segments",
                                               sizeStyle="small",
                                               callback=self.doCurve)
     step += 30
     self.w.warpHButton = vanilla.SquareButton((10, step, -10, 25),
                                               "AutoWarp H",
                                               sizeStyle="small",
                                               callback=self.doWarp)
     step += 24
     self.w.warpHButton.id = "H"
     self.w.warpHVButton = vanilla.SquareButton((10, step, -10, 25),
                                                "AutoWarp H&V",
                                                sizeStyle="small",
                                                callback=self.doWarp)
     self.w.warpHVButton.id = "HV"
     step += 30
     self.w.warpAngle = vanilla.EditText((10, step, 58, 25), "-35")
     self.w.floatDist = vanilla.EditText((72, step, 58, 25), "120")
     step += 35
     self.w.selectionChoice = vanilla.RadioGroup(
         (10, step, -10, 35), ["Current Glyph", "Selected Glyphs"],
         sizeStyle="small")
     self.w.selectionChoice.set(0)
     self.w.open()
コード例 #12
0
    def __init__(self):

        self.debug = False

        # Glyph and font data
        self.glyph = None
        self.LIBKEY = "com.andyclymer.zPosition"
        self.pointData = {}  # dict of x,y,z for each pointID

        self.tempPath = tempfile.mkstemp()[1]
        self.tempHTMLPath = self.tempPath + ".html"

        self.w = vanilla.Window((620, 740),
                                "3D Projection Preview",
                                autosaveName="ProjectionPreview")
        self.w.bind("resize", self.windowResizedCallback)

        topHeight = 65
        self.w.refreshButton = vanilla.SquareButton(
            (10, 10, 130, 25),
            "Reload glyph data",
            callback=self.refreshPreviewCallback,
            sizeStyle="small")

        x = 150
        self.w.zoomScaleChoice = vanilla.PopUpButton(
            (x, 10, 70, 25), ["50%", "75%", "100%", "150%"],
            sizeStyle="small",
            callback=self.refreshPreviewCallback)
        self.w.zoomScaleChoice.set(2)
        self.w.strokeWidth = vanilla.EditText((x + 90, 10, 40, 25), "90")
        self.w.strokeWidth.enable(False)
        self.w.doStrokeBox = vanilla.CheckBox(
            (x + 140, 10, 100, 25),
            "Stroke",
            sizeStyle="small",
            value=False,
            callback=self.refreshPreviewCallback)

        self.w.note = vanilla.TextBox(
            (10, 43, -10, 25),
            "Note: Requires an internet connection for the Zdog library to load, http://www.zzz.dog/",
            sizeStyle="small")

        # Web view
        self.w.webView = WebView.alloc().initWithFrame_(((0, 0), (500, 500)))
        self.w.scroll = vanilla.ScrollView((10, topHeight, -10, -10),
                                           self.w.webView,
                                           hasHorizontalScroller=False,
                                           hasVerticalScroller=False)

        self.w.open()
        self.refreshPreviewCallback(None)
コード例 #13
0
	def __init__( self ):
		# Window 'self.w':
		edX = 40
		edY = 17
		txX = 20
		txY = 17
		slX = 200
		spX = 10
		spY = 10
		btnY = 17
		btnX = 60
		windowWidth  = spX*3+txX+edX+slX
		windowHeight = spY*6+txY*2+btnY*4
		windowWidthResize = 500
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Nudge-Move", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight ), # maximum size (for resizing)
			autosaveName = "com.Tosche.Nudge-movebyNumericalValue(GUI).mainwindow" # stores last window position and size
		)
		
		# UI elements:
		self.w.txX = vanilla.TextBox( (spX, spY, txX, txY), "X:", sizeStyle='small')
		self.w.txY = vanilla.TextBox( (spX, spY*2+txY, txX, txY), "Y:", sizeStyle='small')

		self.w.edX = ArrowEditText( (spX+txX, spY, edX, edY), "10", sizeStyle='small', callback=self.textChange)
		self.w.edY = ArrowEditText( (spX+txX, spY*2+txY, edX, edY), "10", sizeStyle='small', callback=self.textChange)
	
		self.w.slX = vanilla.Slider( (spX*2+txX+edX, spY, -spX, edY), sizeStyle='small', minValue=0, maxValue=50, value=10, callback=self.sliderChange)
		self.w.slY = vanilla.Slider( (spX*2+txX+edX, spY*2+txY, -spX, edY), sizeStyle='small', minValue=0, maxValue=50, value=10, callback=self.sliderChange)

		# Run Button:
		self.w.tl = vanilla.SquareButton((spX, spY*3+txY*2, btnX, btnY), u"↖", sizeStyle='small', callback=self.nudgeMove )
		self.w.l = vanilla.SquareButton((spX, spY*4+txY*2+btnY, btnX, btnY), u"←", sizeStyle='small', callback=self.nudgeMove )
		self.w.dl = vanilla.SquareButton((spX, spY*5+txY*2+btnY*2, btnX, btnY), u"↙", sizeStyle='small', callback=self.nudgeMove )

		self.w.t = vanilla.SquareButton((spX*2+btnX, spY*3+txY*2, btnX, btnY), u"↑", sizeStyle='small', callback=self.nudgeMove )
		self.w.d = vanilla.SquareButton((spX*2+btnX, spY*5+txY*2+btnY*2, btnX, btnY), u"↓", sizeStyle='small', callback=self.nudgeMove )

		self.w.tr = vanilla.SquareButton((spX*3+btnX*2, spY*3+txY*2, btnX, btnY), u"↗", sizeStyle='small', callback=self.nudgeMove )
		self.w.r = vanilla.SquareButton((spX*3+btnX*2, spY*4+txY*2+btnY, btnX, btnY), u"→", sizeStyle='small', callback=self.nudgeMove )
		self.w.dr = vanilla.SquareButton((spX*3+btnX*2, spY*5+txY*2+btnY*2, btnX, btnY), u"↘", sizeStyle='small', callback=self.nudgeMove )

		self.LoadPreferences()

		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
コード例 #14
0
    def __init__(self, parentWindow):

        self.parentWindow = parentWindow

        self.debug = False

        # Glyph and font data
        self.glyph = None
        self.LIBKEY = "com.andyclymer.zPosition"
        self.LIBKEYVIEW = "com.andyclymer.projectionViewOrientation"
        self.pointData = {}  # dict of x,y,z for each pointID

        # Helper attributes
        self.holdChanges = False
        self.currentView = "front"
        self.enableProjection = False  # Enable the buttons and save point data to the lib?

        # Window controls
        self.view = vanilla.Group((30, 30, 100, 100))
        self.view.controlGroup = vanilla.Box((0, 0, 93, 94))
        self.view.controlGroup.buttonFront = vanilla.SquareButton(
            (40, 5, 40, 40), "●", callback=self.rotateFront)
        self.view.controlGroup.buttonFront.enable(False)
        self.view.controlGroup.buttonSide = vanilla.SquareButton(
            (5, 5, 30, 40), "◑", callback=self.rotateSide)
        self.view.controlGroup.buttonSide.enable(False)
        self.view.controlGroup.buttonTop = vanilla.SquareButton(
            (40, 50, 40, 30), "◓", callback=self.rotateTop)
        self.view.controlGroup.buttonTop.enable(False)
        self.view.controlGroup.enableBox = vanilla.CheckBox(
            (13, -38, 25, 25), "", callback=self.enableDisableCallback)

        addObserver(self, "viewWillChangeGlyph", "viewWillChangeGlyph")
        addObserver(self, "viewDidChangeGlyph", "viewDidChangeGlyph")
        addObserver(self, "fontWillSave", "fontWillSave")
        addObserver(self, "fontDidSave", "fontDidSave")
        addObserver(self, "mouseUp", "mouseUp")
コード例 #15
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 300
		windowHeight = 130
		windowWidthResize  = 200 # user can resize width by this value
		windowHeightResize = 0   # user can resize height by this value
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Add Unicode Values to Selected Glyphs", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.CustomUnicode.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		linePos, inset, lineHeight = 12, 15, 22
		
		self.w.descriptionText = vanilla.TextBox( (inset, linePos+3, 190, 14), u"Assign Unicode values starting at:", sizeStyle='small', selectable=True )
		self.w.unicode = vanilla.EditText( (inset+190, linePos, -inset-25, 19), "E700", callback=self.sanitizeEntry, sizeStyle='small' )
		self.w.unicode.getNSTextField().setToolTip_(u"The first selected glyph will receive this Unicode value. Subsequent glyphs will get the next respective Unicode value, until all selected glyphs have received one.")
		self.w.updateButton = vanilla.SquareButton( (-inset-20, linePos, -inset, 18), u"↺", sizeStyle='small', callback=self.update )
		self.w.updateButton.getNSButton().setToolTip_(u"Resets the starting Unicode to the first BMP PUA available in the font. Useful if you do not wish to overwrite existing PUA codes.")
		linePos += lineHeight

		self.w.keepExistingUnicodes = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Keep existing Unicode values", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.keepExistingUnicodes.getNSButton().setToolTip_(u"Two things: it keeps (does not overwrite) the Unicode value of a selected glyph, and it skips Unicode values that are already in use elsewhere in the font. Allows you to select all glyphs and run the script, and thus, assign PUA codes to all unencoded glyphs.")
		linePos += lineHeight

		self.w.includeNonExportingGlyphs = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Include non-exporting glyphs", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.includeNonExportingGlyphs.getNSButton().setToolTip_(u"If disabled, will skip all glyphs that are set to not export. If enabled, will treat all selected glyphs, including non-exporting glyphs.")
		linePos += lineHeight
		
		# Status Message:
		self.w.status = vanilla.TextBox( (inset, -16-inset, -inset, -inset), u"", sizeStyle='small', selectable=True )
		linePos += lineHeight
		
		# Run Button:
		self.w.runButton = vanilla.Button((-80-inset, -20-inset, -inset, -inset), "Assign", sizeStyle='regular', callback=self.CustomUnicodeMain )
		self.w.setDefaultButton( self.w.runButton )
		
		# Load Settings:
		if not self.LoadPreferences():
			print("Note: 'Add PUA Unicode Values to Selected Glyphs' could not load preferences. Will resort to defaults")
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
コード例 #16
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 350
		windowHeight = 140
		windowWidthResize  = 100 # user can resize width by this value
		windowHeightResize = 0   # user can resize height by this value
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Set Family Alignment Zones", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.SetFamilyAlignmentZones.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		linePos, inset, lineHeight = 12, 15, 22
		
		self.w.descriptionText = vanilla.TextBox( (inset, linePos+2, -inset, lineHeight*2), u"Choose an instance (typically the Regular), and insert its zones as PostScript Family Alignment Zones.", sizeStyle='small', selectable=True )
		linePos += lineHeight*2
		
		self.w.instanceText = vanilla.TextBox( (inset, linePos+2, inset+55, 14), u"Instance:", sizeStyle='small', selectable=True )
		
		self.w.instancePicker = vanilla.PopUpButton( (inset+55, linePos, -inset-25, 17), (), sizeStyle='small' )
		self.w.instancePicker.getNSPopUpButton().setToolTip_("Inactive instances are marked.")
		# set font to tabular figures:
		popUpFont = NSFont.monospacedDigitSystemFontOfSize_weight_(NSFont.smallSystemFontSize(), 0.0)
		self.w.instancePicker.getNSPopUpButton().setFont_(popUpFont)
		
		self.w.updateButton = vanilla.SquareButton( (-inset-20, linePos, -inset, 18), u"↺", sizeStyle='small', callback=self.updateInstancePicker )
		self.w.updateButton.getNSButton().setToolTip_("Click to update the menu with the instances of the current font.")
		linePos += lineHeight
		
		# Run Button:
		self.w.runButton = vanilla.Button( (-110-inset, -20-inset, -inset, -inset), "Insert FAZ", sizeStyle='regular', callback=self.SetFamilyAlignmentZonesMain )
		self.w.setDefaultButton( self.w.runButton )
		
		
		# Open window and focus on it:
		self.updateInstancePicker()
		self.w.open()
		self.w.makeKey()
コード例 #17
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 270
		windowHeight = 145
		windowWidthResize  = 200 # user can resize width by this value
		windowHeightResize = 0   # user can resize height by this value
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Set ssXX Names", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.SetSSXXNames.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		linePos, inset, lineHeight = 12, 12, 22
		self.w.descriptionText = vanilla.TextBox( (inset, linePos+2, -inset, 30), u"Prefill human-readable names for Stylistic Set features ss01-ss20 with a default phrase:", sizeStyle='small', selectable=True )
		linePos += int(lineHeight*1.8)
		
		self.w.alternateText = vanilla.TextBox( (inset, linePos+2, 85, 14), u"Default Name:", sizeStyle='small', selectable=True )
		self.w.alternate = vanilla.EditText( (inset+85, linePos-1, -inset-25, 19), self.defaultName, callback=self.SavePreferences, sizeStyle='small' )
		self.w.alternate.getNSTextField().setToolTip_(u"The script will look for the first substituted glyph in every ssXX, e.g., ‘a’, and construct a Stylistic Set name with this Default Name plus the name of the first substituted glyph, e.g., ‘Alternate a’.")
		self.w.alternateUpdateButton = vanilla.SquareButton( (-inset-20, linePos, -inset, 18), u"↺", sizeStyle='small', callback=self.SavePreferences )
		self.w.alternateUpdateButton.getNSButton().setToolTip_(u"Will reset default name to ‘%s’."%self.defaultName)
		linePos += lineHeight
		
		self.w.overwrite = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Overwrite existing names", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.overwrite.getNSButton().setToolTip_(u"If set, will skip ssXX features that already have a ‘Name:’ entry in their feature notes. If unset, will reset all ssXX names.")
		linePos += lineHeight
		
		# Run Button:
		self.w.runButton = vanilla.Button( (-120-inset, -20-inset, -inset, -inset), "Fill Names", sizeStyle='regular', callback=self.SetSSXXNamesMain )
		self.w.setDefaultButton( self.w.runButton )
		
		# Load Settings:
		if not self.LoadPreferences():
			print("Note: 'Set ssXX Names' could not load preferences. Will resort to defaults")
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
コード例 #18
0
 def __init__(self):
     
     self.fontList = AllFonts()
     self.fontNames = [getFontName(f) for f in self.fontList]
     
     self.w = vanilla.Window((300, 200), "Build Rotated Masters")
     
     self.w.descriptionText = vanilla.TextBox((10, 10, -10, 50), "Rotate a UFO that has “3D Projection View” glyph depth data. Nine UFO masters and a designSpace file will be created.", sizeStyle="small")
     
     self.w.fontChoice = vanilla.PopUpButton((10, 60, -10, 25), self.fontNames)
     
     self.w.glyphChoice = vanilla.PopUpButton((10, 90, -10, 25), ["All glyphs", "Selected glyphs"])
     
     self.w.outlineBox = vanilla.CheckBox((10, 125, -10, 25), "Outline Paths", callback=self.outlineChanged)
     self.w.outlineAmount = NumberEditText((115, 125, 50, 25), "90", 
         allowFloat=False, allowNegative=False, minimum=1)
     self.w.outlineAmount.enable(False)
     self.w.unitsTitle = vanilla.TextBox((170, 129, -10, 25), "units")
     
     self.w.copyButton = vanilla.SquareButton((10, 165, -10, 25), "Rotate!", callback=self.rotateFont)
     self.w.open()
コード例 #19
0
    def __init__(self):

        self.fontList = []
        self.fontNames = []
        self.fontStems = []
        self.estimatedStems = None  # Estimated stem measurements for the resulting font

        # Glyph groups
        self.groups = []

        # Case info, normalized after editing
        self.normalizedInfo = {}
        self.dataNorms = {
            "scaleH": dict(default=100, dataType=float, scale=0.01),
            "scaleV": dict(default=100, dataType=float, scale=0.01),
            "interpH": dict(default=100, dataType=float, scale=0.01),
            "interpV": dict(default=100, dataType=float, scale=0.01),
            "tracking": dict(default=0, dataType=float, scale=1)
        }

        self.w = vanilla.Window((317, 700),
                                "Scale And Interpolate %s" % VERSION,
                                minSize=(317, 300),
                                maxSize=(317, 969),
                                autosaveName="ScaleAndInterp")  # 882 height

        self.g = vanilla.Group((0, 0, 300, 900))

        step = 10
        self.g.font0title = vanilla.TextBox((10, step, -10, 25),
                                            colorText("Lightest Master (0%)",
                                                      style="bold"))
        self.g.font0choice = vanilla.PopUpButton(
            (10, step + 20, -10, 25),
            self.fontNames,
            callback=self.fontChoiceChanged)
        step += 50
        self.g.font0stemTextUC = vanilla.TextBox((20, step, -10, 20), "")
        self.g.font0stemTextLC = vanilla.TextBox((20, step + 20, -10, 20), "")
        step += 50
        self.g.font1title = vanilla.TextBox((10, step, -10, 25),
                                            colorText("Heaviest Master (100%)",
                                                      style="bold"))
        self.g.font1choice = vanilla.PopUpButton(
            (10, step + 20, -10, 25),
            self.fontNames,
            callback=self.fontChoiceChanged)
        step += 50
        self.g.font1stemTextUC = vanilla.TextBox((20, step, -10, 20), "")
        self.g.font1stemTextLC = vanilla.TextBox((20, step + 20, -10, 20), "")
        step += 50

        self.g.hr1 = vanilla.HorizontalLine((10, step, -10, 1))

        step += 15
        self.g.capsTitle = vanilla.TextBox((10, step, -10, 25),
                                           colorText("Caps", style="bold"))
        step += 25
        self.g.ucGroups = vanilla.PopUpButton((10, step, -10, 25), [])
        step += 35
        columnDescriptions = [
            dict(title="Name"),
            dict(title="Value", editable=True, width=50)
        ]
        capInfo = [
            dict(Name="Scale Horizontal %", attr="scaleH", Value=100),
            dict(Name="Scale Vertical %", attr="scaleV", Value=100),
            dict(Name="Interpolate Horizontal %", attr="interpH", Value=100),
            dict(Name="Interpolate Vertical %", attr="interpV", Value=100),
            dict(Name="Units of tracking", attr="tracking", Value=0)
        ]
        self.g.ucInfo = vanilla.List((10, step, -10, 100),
                                     capInfo,
                                     columnDescriptions=columnDescriptions,
                                     showColumnTitles=False,
                                     editCallback=self.dataChanged)
        step += 110
        self.g.resultStemTextUC = vanilla.TextBox((20, step, -10, 20), "")
        step += 30

        self.g.lcTitle = vanilla.TextBox((10, step, -10, 25),
                                         colorText("Lowercase", style="bold"))
        step += 25
        self.g.lcGroups = vanilla.PopUpButton((10, step, -10, 25), [])
        step += 35
        lcInfo = [
            dict(Name="Scale Horizontal %", attr="scaleH", Value=100),
            dict(Name="Scale Vertical %", attr="scaleV", Value=100),
            dict(Name="Interpolate Horizontal %", attr="interpH", Value=100),
            dict(Name="Interpolate Vertical %", attr="interpV", Value=100),
            dict(Name="Units of tracking", attr="tracking", Value=0)
        ]
        self.g.lcInfo = vanilla.List((10, step, -10, 100),
                                     lcInfo,
                                     columnDescriptions=columnDescriptions,
                                     showColumnTitles=False,
                                     editCallback=self.dataChanged)
        step += 110
        self.g.resultStemTextLC = vanilla.TextBox((20, step, -10, 20), "")
        step += 30

        self.g.otherTitle = vanilla.TextBox((10, step, -10, 25),
                                            colorText("Other glyphs",
                                                      style="bold"))
        step += 25
        self.g.otherRadio = vanilla.RadioGroup((10, step, -10, 70), [
            "Copy from the lightest master",
            "Process at 50% of UC and LC settings", "Skip any other glyphs"
        ],
                                               callback=self.dataChanged)
        self.g.otherRadio.set(2)

        step += 80

        self.g.loadButton = vanilla.SquareButton((100, step, -10, 25),
                                                 "Load settings from UFO",
                                                 callback=self.loadSettings)
        step += 35

        self.g.hr2 = vanilla.HorizontalLine((10, step, -10, 1))
        step += 15
        self.g.skewBox = vanilla.CheckBox(
            (10, step, -10, 25), "Skew Italic glyphs upright before scaling")
        self.g.skewBox.set(True)
        step += 25
        self.g.infoBox = vanilla.CheckBox(
            (10, step, -10, 25), "Interpolate Font Info whenever possible")
        self.g.infoBox.set(True)
        step += 25
        self.g.scaleComponentBox = vanilla.CheckBox(
            (10, step, -10, 25), "Don’t scale component positions")
        self.g.scaleComponentBox.set(True)
        step += 25
        self.g.doKernBox = vanilla.CheckBox((10, step, -10, 25),
                                            "Process Kerning")
        self.g.doKernBox.set(True)
        step += 3
        self.g.testKernButton = vanilla.SquareButton(
            (135, step, -10, 25),
            "Compatibility Test",
            callback=self.kernCompatibilityTestCallback)

        #step += 40
        self.w.buildButton = vanilla.SquareButton(
            (10, -35, -10, 25), "Make Font", callback=self.makeFontCallback)

        # Add the group to a ScrollView
        view = self.g.getNSView()
        self.w.sv = vanilla.ScrollView(
            (0, 0, -0, -45),
            view,
            hasHorizontalScroller=False,
            hasVerticalScroller=True,
            autohidesScrollers=False,
            drawsBackground=False
        )  #backgroundColor=NSColor.windowBackgroundColor())

        # Update the font info before opening
        self.fontsChanged()
        self.dataChanged()

        addObserver(self, "fontsChanged", "fontDidOpen")
        addObserver(self, "fontsChanged", "newFontDidOpen")
        addObserver(self, "fontsChanged", "fontDidClose")
        self.w.bind("close", self.windowClosed)
        self.w.open()
コード例 #20
0
ファイル: Axis Mapper.py プロジェクト: ottta/Glyphs-Scripts-1
    def __init__(self):
        # Window 'self.w':
        windowWidth = 380
        windowHeight = 160
        windowWidthResize = 500  # user can resize width by this value
        windowHeightResize = 600  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Axis Mapper",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.AxisMapper.mainwindow"  # stores last window position and size
        )

        # UI elements:
        linePos, inset, lineHeight = 4, 10, 22

        self.w.descriptionText = vanilla.TextBox(
            (inset, linePos + 2, -inset, 14),
            "Axis Mapping from user-visible (not native) values:",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

        self.w.axisPicker = vanilla.ComboBox((inset, linePos - 1, 60, 20),
                                             self.AxisListForFrontmostFont(),
                                             callback=self.SavePreferences,
                                             sizeStyle='small')
        self.w.axisPicker.getNSComboBox().setToolTip_(
            "Pick or type the 4-letter tag of the axis for which you want to edit the mapping."
        )
        self.w.axisReset = vanilla.SquareButton((inset + 65, linePos, 20, 18),
                                                "↺",
                                                sizeStyle='small',
                                                callback=self.resetAxisList)
        self.w.axisReset.getNSButton().setToolTip_(
            "Will populate the axis picker with the tags for all axes in the frontmost font."
        )

        self.w.minText = vanilla.TextBox((inset + 100, linePos + 2, 55, 14),
                                         "Axis Min:",
                                         sizeStyle='small',
                                         selectable=True)
        self.w.minValue = vanilla.EditText(
            (inset + 100 + 55, linePos - 1, 40, 19),
            self.MinimumForCurrentAxis(),
            callback=self.SavePreferences,
            sizeStyle='small')
        tooltipText = "User-visible slider minimum, typically set with an Axis Location parameter. Not (necessarily) the native master value."
        self.w.minText.getNSTextField().setToolTip_(tooltipText)
        self.w.minValue.getNSTextField().setToolTip_(tooltipText)
        self.w.minValueReset = vanilla.SquareButton(
            (inset + 100 + 60 + 40, linePos, 20, 18),
            "↺",
            sizeStyle='small',
            callback=self.resetMinimum)
        self.w.minValueReset.getNSButton().setToolTip_(
            "Will attempt to guess the user-visible slider minimum of the frontmost font."
        )

        self.w.maxText = vanilla.TextBox((inset + 230, linePos + 2, 55, 14),
                                         "Axis Max:",
                                         sizeStyle='small',
                                         selectable=True)
        self.w.maxValue = vanilla.EditText(
            (inset + 230 + 55, linePos - 1, 40, 19),
            self.MaximumForCurrentAxis(),
            callback=self.SavePreferences,
            sizeStyle='small')
        tooltipText = "User-visible slider maximum, typically set with an Axis Location parameter. Not (necessarily) the native master value."
        self.w.maxText.getNSTextField().setToolTip_(tooltipText)
        self.w.maxValue.getNSTextField().setToolTip_(tooltipText)
        self.w.maxValueReset = vanilla.SquareButton(
            (inset + 230 + 60 + 40, linePos, 20, 18),
            "↺",
            sizeStyle='small',
            callback=self.resetMaximum)
        self.w.maxValueReset.getNSButton().setToolTip_(
            "Will attempt to guess the user-visible slider maximum of the frontmost font."
        )
        linePos += lineHeight

        self.w.mappingRecipe = vanilla.TextEditor(
            (0, linePos, -0, -20 - inset * 2),
            text=fallbackText.strip(),
            callback=self.SavePreferences,
            checksSpelling=False)
        legibleFont = NSFont.legibileFontOfSize_(NSFont.systemFontSize())
        textView = self.w.mappingRecipe.getNSTextView()
        textView.setFont_(legibleFont)

        # Buttons:
        self.w.recipeButton = vanilla.Button((inset, -20 - inset, 120, -inset),
                                             "Reset Recipe",
                                             sizeStyle='regular',
                                             callback=self.ResetRecipe)
        self.w.recipeButton.getNSButton().setToolTip_(
            "Construct a fallback axis mapping recipe for axis and the min/max values above, based on the existing active instances. Can be a good start for creating new mappings. Respects the weightClass settings for the 'wght' axis."
        )

        self.w.extractButton = vanilla.Button(
            (inset + 130, -20 - inset, 120, -inset),
            "Extract Recipe",
            sizeStyle='regular',
            callback=self.ExtractAxisMapping)
        self.w.extractButton.getNSButton().setToolTip_(
            "Extract the axis mapping recipe for the chosen axis from an existing Axis Mappings parameter, and into the min/max values specified above. Will do nothing if it fails. Great for editing existing mappings."
        )

        self.w.runButton = vanilla.Button(
            (-80 - inset, -20 - inset, -inset, -inset),
            "Map",
            sizeStyle='regular',
            callback=self.AxisMapperMain)
        self.w.runButton.getNSButton().setToolTip_(
            "Write the current mapping recipe into an Axis Mappings parameter for the frontmost font."
        )
        self.w.setDefaultButton(self.w.runButton)

        # Load Settings:
        if not self.LoadPreferences():
            print(
                "Note: 'Axis Mapper' could not load preferences. Will resort to defaults"
            )

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
コード例 #21
0
ファイル: Auto Bumper.py プロジェクト: NaN-xyz/Glyphs-Scripts
    def __init__(self):
        # register prefs if run for the first time:
        if not Glyphs.defaults["com.mekkablue.Bumper.kernStrings"]:
            self.RegisterPreferences()

        # Window 'self.w':
        windowWidth = 500
        windowHeight = 365
        windowWidthResize = 500  # user can resize width by this value
        windowHeightResize = 500  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Auto Bumper",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.Bumper.mainwindow"  # stores last window position and size
        )

        # UI elements:
        inset, lineHeight, currentHeight = 14, 24, -10
        currentHeight += lineHeight

        self.w.text_1 = vanilla.TextBox(
            (inset, currentHeight, -inset, 14),
            "Add supplementary kerning for specified glyphs in the current master:",
            sizeStyle='small')
        currentHeight += lineHeight

        self.w.swapButton = vanilla.SquareButton(
            (-inset - 20, currentHeight, -inset, 42),
            u"↰\n↲",
            sizeStyle='regular',
            callback=self.swap)

        self.w.text_left = vanilla.TextBox((inset, currentHeight + 3, 80, 14),
                                           "Left glyphs:",
                                           sizeStyle='small')
        self.w.leftGlyphs = vanilla.ComboBox(
            (inset + 80, currentHeight, -inset - 102, 18),
            self.kernStringList(self),
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.leftGlyphs.getNSComboBox().setToolTip_(
            u"Measures the specified glyphs from their right side to the following glyph. You can type the character ‘é’ or the slash-escaped glyph name ‘/eacute’. Or specify a category after an at sign ‘@Letter’, add a subcategory after a colon ‘@Letter:Lowercase’.\nAdd default strings in the text box at the bottom of the window. Expand the window at the bottom to access it."
        )
        self.w.leftIsGroups = vanilla.CheckBox(
            (-inset - 94, currentHeight + 1, -inset - 22, 17),
            u"As groups",
            value=True,
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.leftIsGroups.getNSButton().setToolTip_(
            u"If on, will measure only the specified glyph, but set the calculated kerning for the whole right group of the glyph (i.e., add group kerning). If off, will set the kerning for the glyph only (i.e., add an exception)."
        )
        currentHeight += lineHeight

        self.w.text_right = vanilla.TextBox((inset, currentHeight + 3, 80, 14),
                                            "Right glyphs:",
                                            sizeStyle='small')
        self.w.rightGlyphs = vanilla.ComboBox(
            (inset + 80, currentHeight, -inset - 102, 18),
            self.kernStringList(self),
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.rightGlyphs.getNSComboBox().setToolTip_(
            u"Measures from the previous glyphs to the specified glyphs to their left side. You can type the character ‘é’ or the slash-escaped glyph name ‘/eacute’. Or specify a category after an at sign ‘@Letter’, add a subcategory after a colon ‘@Letter:Lowercase’.\nAdd default strings in the text box at the bottom of the window. Expand the window at the bottom to access it."
        )
        self.w.rightIsGroups = vanilla.CheckBox(
            (-inset - 94, currentHeight + 1, -inset - 22, 17),
            u"As groups",
            value=True,
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.rightIsGroups.getNSButton().setToolTip_(
            u"If on, will measure only the specified glyph, but set the calculated kerning for the whole left group of the glyph (i.e., add group kerning). If off, will set the kerning for the glyph only (i.e., add an exception)."
        )
        currentHeight += lineHeight

        self.w.suffixText = vanilla.TextBox((inset, currentHeight + 3, 80, 14),
                                            u"Add suffix:",
                                            sizeStyle='small',
                                            selectable=True)
        self.w.suffix = vanilla.EditText((inset + 80, currentHeight, 150, 19),
                                         "",
                                         callback=self.SavePreferences,
                                         sizeStyle='small')
        self.w.suffix.getNSTextField().setToolTip_(
            "Looks for the suffixed version of the listed glyphs, with this suffix added to the name. Useful with .sc for smallcaps. Enter WITH the leading dot for dot suffixes. Can also be used with 'superior' for figures."
        )
        currentHeight += lineHeight

        self.w.text_21 = vanilla.TextBox((inset, currentHeight + 3, 80, 14),
                                         "Min distance:",
                                         sizeStyle='small')
        self.w.minDistance = vanilla.EditText(
            (inset + 80, currentHeight, 60, 19),
            "50",
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.minDistance.getNSTextField().setPlaceholderString_("50")
        self.w.minDistance.getNSTextField().setToolTip_(
            u"Adds kerning if the shortest distance between two glyphs is shorter than specified value. Leave blank or set to zero to ignore."
        )
        self.w.text_22 = vanilla.TextBox(
            (inset + 80 * 2, currentHeight + 3, 80, 14),
            "Max distance:",
            sizeStyle='small')
        self.w.maxDistance = vanilla.EditText(
            (inset + 80 * 3, currentHeight, 60, 19),
            "200",
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.maxDistance.getNSTextField().setPlaceholderString_("200")
        self.w.maxDistance.getNSTextField().setToolTip_(
            u"Adds kerning if the shortest distance between two glyphs is larger than specified value. Leave blank or set to zero to ignore."
        )
        self.w.text_23 = vanilla.TextBox(
            (inset + 80 * 4, currentHeight + 3, 80, 14),
            "Round by:",
            sizeStyle='small')
        self.w.roundFactor = vanilla.EditText(
            (inset + 80 * 5, currentHeight, -inset, 19),
            "10",
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.roundFactor.getNSTextField().setPlaceholderString_("10")
        self.w.roundFactor.getNSTextField().setToolTip_(
            u"Rounds calculated kerning. Leave blank or set to zero to ignore."
        )
        currentHeight += lineHeight

        self.w.text_speed = vanilla.TextBox((inset, currentHeight + 3, 42, 14),
                                            "Speed:",
                                            sizeStyle='small')
        self.w.speedPopup = vanilla.PopUpButton(
            (inset + 42, currentHeight + 1, 80, 17),
            ["very slow", "slow", "medium", "fast", "very fast"],
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.speedPopup.getNSPopUpButton().setToolTip_(
            u"Specifies the number of measurements. Measuring is processor-intensive and can take a while. Slow: many measurements, fast: few measurements."
        )
        intervalIndex = Glyphs.defaults["com.mekkablue.Bumper.speedPopup"]
        if intervalIndex is None:
            intervalIndex = 0
        self.w.text_speedExplanation = vanilla.TextBox(
            (inset + 42 + 90, currentHeight + 3, -15, 14),
            "Measuring every %i units." % intervalList[intervalIndex],
            sizeStyle='small')
        currentHeight += lineHeight

        self.w.text_6 = vanilla.TextBox((inset, currentHeight + 3, 130, 14),
                                        "Ignore height intervals:",
                                        sizeStyle='small')
        self.w.ignoreIntervals = vanilla.EditText(
            (inset + 130, currentHeight, -inset, 19),
            "",
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.ignoreIntervals.getNSTextField().setPlaceholderString_(
            "200:300, 400:370, -200:-150")
        self.w.ignoreIntervals.getNSTextField().setToolTip_(
            u"Does not measure on y coordinates in intervals specified as y1:y2. Separate multiple intervals with commas."
        )
        currentHeight += lineHeight

        self.w.keepExistingKerning = vanilla.CheckBox(
            (inset + 5, currentHeight, -inset, 17),
            u"Keep (don’t overwrite) existing kerning",
            value=True,
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.keepExistingKerning.getNSButton().setToolTip_(
            u"If the kern pair already exists in the font, it will not be overwritten."
        )
        currentHeight += lineHeight

        self.w.excludeNonExporting = vanilla.CheckBox(
            (inset + 5, currentHeight, 200, 17),
            u"Exclude non-exporting glyphs",
            value=True,
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.excludeNonExporting.getNSButton().setToolTip_(
            u"If one of the specified glyphs is not set to export, Auto Bumper will skip it."
        )
        self.w.avoidZeroKerning = vanilla.CheckBox(
            (inset + 200, currentHeight, -inset, 17),
            u"Avoid zero kerns",
            value=True,
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.avoidZeroKerning.getNSButton().setToolTip_(
            u"If the calculated (and rounded) kerning value is 0, it will not be added to the font."
        )
        currentHeight += lineHeight

        self.w.reportInMacroWindow = vanilla.CheckBox(
            (inset + 5, currentHeight, -inset, 17),
            u"Also report in Macro Window (a few seconds slower)",
            value=False,
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.reportInMacroWindow.getNSButton().setToolTip_(
            u"Outputs a detailed report in the Macro Window, and opens it.")
        currentHeight += lineHeight

        self.w.openNewTabWithKernPairs = vanilla.CheckBox(
            (inset + 5, currentHeight, -inset, 17),
            u"Open new Edit tab with new kern pairs",
            value=False,
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.openNewTabWithKernPairs.getNSButton().setToolTip_(
            u"If kern pairs were added, opens them in a new Edit tab, for inspection."
        )
        currentHeight += lineHeight

        # Progress Bar:
        self.w.bar = vanilla.ProgressBar((inset, currentHeight, -inset, 16))
        currentHeight += lineHeight

        # (Hidden) Preferences Kern Strings:
        self.w.kernStrings = vanilla.TextEditor((1, currentHeight, -1, -45),
                                                callback=self.SavePreferences)
        self.w.kernStrings.getNSTextView().setToolTip_(
            "Add your default kern strings here. They will show up in the left/right dropdowns at the top. Everything after a hashtag (#) is ignored. Use blank lines for structuring."
        )

        self.w.text_kernStrings = vanilla.TextBox(
            (inset, -14 - inset, -100 - inset, -inset),
            "Expand window below to access default strings.",
            sizeStyle='small')
        self.w.text_kernStrings.getNSTextField().setTextColor_(
            NSColor.colorWithRed_green_blue_alpha_(0, 0, 0, 0.2))

        # Run Button:
        self.w.runButton = vanilla.Button(
            (-100 - inset, -20 - inset, -inset, -inset),
            "Kern",
            sizeStyle='regular',
            callback=self.BumperMain)
        self.w.setDefaultButton(self.w.runButton)

        # Load Settings:
        if not self.LoadPreferences():
            print(
                "Note: Auto Bumper could not load preferences. Will resort to defaults"
            )

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
コード例 #22
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 285
        windowHeight = 190
        windowWidthResize = 100  # user can resize width by this value
        windowHeightResize = 300  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Style Renamer",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.StyleRenamer.mainwindow"  # stores last window position and size
        )

        # UI elements:
        linePos, inset, lineHeight = 12, 15, 24
        column = 55

        self.w.subtractOrAdd = vanilla.PopUpButton(
            (inset, linePos, 145, 17),
            ("Subtract particle from", "Add particle to"),
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.subtractOrAddText = vanilla.TextBox(
            (inset + 150, linePos + 2, -inset, 14),
            "all instance names:",
            sizeStyle='small',
            selectable=True)
        tooltipText = "Choose here if you want to add the chosen particle name to all styles, or remove it from them."
        self.w.subtractOrAdd.getNSPopUpButton().setToolTip_(tooltipText)
        self.w.subtractOrAddText.getNSTextField().setToolTip_(tooltipText)
        linePos += lineHeight

        self.w.particleText = vanilla.TextBox((inset, linePos + 3, column, 14),
                                              "Particle:",
                                              sizeStyle='small',
                                              selectable=True)
        self.w.particle = vanilla.EditText(
            (inset + column, linePos, -inset - 25, 19),
            particleDefault,
            callback=self.SavePreferences,
            sizeStyle='small')
        tooltipText = "This is the name part you want to add to the name, or erase from it. Typically something like ‘%s’." % particleDefault
        self.w.particleText.getNSTextField().setToolTip_(tooltipText)
        self.w.particle.getNSTextField().setToolTip_(tooltipText)
        self.w.particleUpdate = vanilla.SquareButton(
            (-inset - 20, linePos, -inset, 18),
            "↺",
            sizeStyle='small',
            callback=self.update)
        self.w.particleUpdate.getNSButton().setToolTip_(
            "Will reset the name particle to ‘%s’." % particleDefault)
        linePos += lineHeight

        self.w.elidablePartText = vanilla.TextBox(
            (inset, linePos + 3, column, 14),
            "Elidable:",
            sizeStyle='small',
            selectable=True)
        self.w.elidablePart = vanilla.EditText(
            (inset + column, linePos, -inset - 25, 19),
            elidablePartDefault,
            callback=self.SavePreferences,
            sizeStyle='small')
        tooltipText = "Typically something like ‘%s’. This is the stub name part that will be the name of the style if it would be otherwise empty, e.g., remove the word ‘%s’ from the style ‘%s’, and the style name would be empty, so the elidable name kicks in, and the style is ‘%s’.\nOr, the other way around, the part of the name that gets deleted from the name, as soon as you add any particle to it. E.g., you add ‘%s’ to ‘%s’, and instead of calling it ‘%s %s’, it will be simply ‘%s’." % (
            elidablePartDefault, particleDefault, particleDefault,
            elidablePartDefault, particleDefault, elidablePartDefault,
            elidablePartDefault, particleDefault, particleDefault)
        self.w.elidablePartText.getNSTextField().setToolTip_(tooltipText)
        self.w.elidablePart.getNSTextField().setToolTip_(tooltipText)
        self.w.elidablePartUpdate = vanilla.SquareButton(
            (-inset - 20, linePos, -inset, 18),
            "↺",
            sizeStyle='small',
            callback=self.update)
        self.w.elidablePartUpdate.getNSButton().setToolTip_(
            "Will reset the elidable part of style name to ‘%s’." %
            elidablePartDefault)
        linePos += lineHeight

        self.w.includeInactiveInstances = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            "Include inactive instances",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.includeInactiveInstances.getNSButton().setToolTip_(
            "If turned, will add/remove the particle to/from all instances, rather than just the active ones."
        )
        linePos += lineHeight

        self.w.preview = vanilla.Box((inset, linePos, -inset, -30 - inset))
        self.w.preview.previewText = vanilla.TextBox((5, 1, -5, -1),
                                                     "",
                                                     sizeStyle='small',
                                                     selectable=True)
        linePos += lineHeight

        # Run Button:
        self.w.runButton = vanilla.Button(
            (-90 - inset, -20 - inset, -inset, -inset),
            "Rename",
            sizeStyle='regular',
            callback=self.StyleRenamerMain)
        self.w.setDefaultButton(self.w.runButton)

        # Load Settings:
        if not self.LoadPreferences():
            print(
                "Note: 'Style Renamer' could not load preferences. Will resort to defaults"
            )

        self.fileManager = NSFileManager.alloc().init()
        self.updatePreviewText()

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
コード例 #23
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 330
        windowHeight = 375
        windowWidthResize = 100  # user can resize width by this value
        windowHeightResize = 0  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Vertical Metrics Manager",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.VerticalMetricsManager.mainwindow"  # stores last window position and size
        )

        # UI elements:
        linePos, inset, lineHeight = 12, 15, 22

        self.w.descriptionText = vanilla.TextBox(
            (inset, linePos + 2, -inset, 14),
            u"Manage and sync hhea, typo and win values.",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

        self.w.titleAscent = vanilla.TextBox((inset + 70, linePos + 4, 70, 14),
                                             u"Ascender",
                                             sizeStyle='small',
                                             selectable=True)
        self.w.titleDescent = vanilla.TextBox(
            (inset + 140, linePos + 4, 70, 14),
            u"Descender",
            sizeStyle='small',
            selectable=True)
        self.w.titleLineGap = vanilla.TextBox(
            (inset + 210, linePos + 4, 70, 14),
            u"Line Gap",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

        self.w.titleWin = vanilla.TextBox((inset, linePos + 3, 70, 14),
                                          u"OS/2 usWin",
                                          sizeStyle='small',
                                          selectable=True)
        self.w.winAsc = vanilla.EditText((inset + 70, linePos, 65, 19),
                                         "",
                                         callback=self.SavePreferences,
                                         sizeStyle='small')
        self.w.winAsc.getNSTextField().setToolTip_(
            "OS/2 usWinAscent. Should be the maximum height in your font. Expect clipping or rendering artefacts beyond this point."
        )
        self.w.winDesc = vanilla.EditText((inset + 140, linePos, 65, 19),
                                          "",
                                          callback=self.SavePreferences,
                                          sizeStyle='small')
        self.w.winDesc.getNSTextField().setToolTip_(
            "OS/2 usWinDescent (unsigned integer). Should be the maximum depth in your font, like the lowest descender you have. Expect clipping or rendering artefacts beyond this point."
        )
        self.w.winGap = vanilla.EditText((inset + 210, linePos, 65, 19),
                                         "",
                                         callback=None,
                                         sizeStyle='small',
                                         readOnly=True,
                                         placeholder=u"n/a")
        self.w.winGap.getNSTextField().setToolTip_(
            "OS/2 usWinLineGap does not exist, hence greyed out here.")
        self.w.winUpdate = vanilla.SquareButton((inset + 280, linePos, 20, 19),
                                                u"↺",
                                                sizeStyle='small',
                                                callback=self.update)
        self.w.winUpdate.getNSButton().setToolTip_(
            "Will recalculate the OS/2 usWin values in the fields to the left. Takes the measurement settings below into account, except for the Limit options."
        )
        linePos += lineHeight

        self.w.titleTypo = vanilla.TextBox((inset, linePos + 3, 70, 14),
                                           u"OS/2 sTypo",
                                           sizeStyle='small',
                                           selectable=True)
        self.w.typoAsc = vanilla.EditText((inset + 70, linePos, 65, 19),
                                          "",
                                          callback=self.SavePreferences,
                                          sizeStyle='small')
        self.w.typoAsc.getNSTextField().setToolTip_(
            "OS/2 sTypoAscender (positive value), should be the same as hheaAscender. Should be the maximum height of the glyphs relevant for horizontal text setting in your font, like the highest accented uppercase letter, typically Aring or Ohungarumlaut. Used for first baseline offset in DTP and office apps and together with the line gap value, also in browsers."
        )
        self.w.typoDesc = vanilla.EditText((inset + 140, linePos, 65, 19),
                                           "",
                                           callback=self.SavePreferences,
                                           sizeStyle='small')
        self.w.typoDesc.getNSTextField().setToolTip_(
            "OS/2 sTypoDescender (negative value), should be the same as hheaDescender. Should be the maximum depth of the glyphs relevant for horizontal text setting in your font, like the lowest descender or bottom accent, typically Gcommaccent, Ccedilla, or one of the lowercase descenders (gjpqy). Together with the line gap value, used for line distance calculation in office apps and browsers."
        )
        self.w.typoGap = vanilla.EditText((inset + 210, linePos, 65, 19),
                                          "",
                                          callback=self.SavePreferences,
                                          sizeStyle='small')
        self.w.typoGap.getNSTextField().setToolTip_(
            "OS/2 sTypoLineGap (positive value), should be the same as hheaLineGap. Should be either zero or a value for padding between lines that makes sense visually. Office apps insert this distance between the lines, browsers add half on top and half below each line, also for determining text object boundaries."
        )
        self.w.typoUpdate = vanilla.SquareButton(
            (inset + 280, linePos, 20, 19),
            u"↺",
            sizeStyle='small',
            callback=self.update)
        self.w.typoUpdate.getNSButton().setToolTip_(
            "Will recalculate the OS/2 sTypo values in the fields to the left. Takes the measurement settings below into account."
        )
        linePos += lineHeight

        self.w.titleHhea = vanilla.TextBox((inset, linePos + 3, 70, 14),
                                           u"hhea",
                                           sizeStyle='small',
                                           selectable=True)
        self.w.hheaAsc = vanilla.EditText((inset + 70, linePos, 65, 19),
                                          "",
                                          callback=self.SavePreferences,
                                          sizeStyle='small')
        self.w.hheaAsc.getNSTextField().setToolTip_(
            "hheaAscender (positive value), should be the same as OS/2 sTypoAscender. Should be the maximum height of the glyphs relevant for horizontal text setting in your font, like the highest accented uppercase letter, typically Aring or Ohungarumlaut. Used for first baseline offset in Mac office apps and together with the line gap value, also in Mac browsers."
        )
        self.w.hheaDesc = vanilla.EditText((inset + 140, linePos, 65, 19),
                                           "",
                                           callback=self.SavePreferences,
                                           sizeStyle='small')
        self.w.hheaDesc.getNSTextField().setToolTip_(
            "hheaDescender (negative value), should be the same as OS/2 sTypoDescender. Should be the maximum depth of the glyphs relevant for horizontal text setting in your font, like the lowest descender or bottom accent, typically Gcommaccent, Ccedilla, or one of the lowercase descenders (gjpqy). Together with the line gap value, used for line distance calculation in office apps and browsers."
        )
        self.w.hheaGap = vanilla.EditText((inset + 210, linePos, 65, 19),
                                          "",
                                          callback=self.SavePreferences,
                                          sizeStyle='small')
        self.w.hheaGap.getNSTextField().setToolTip_(
            "hheaLineGap (positive value), should be the same as OS/2 sTypoLineGap. Should be either zero or a value for padding between lines that makes sense visually. Mac office apps insert this distance between the lines, Mac browsers add half on top and half below each line, also for determining text object boundaries."
        )
        self.w.hheaUpdate = vanilla.SquareButton(
            (inset + 280, linePos, 20, 19),
            u"↺",
            sizeStyle='small',
            callback=self.update)
        self.w.hheaUpdate.getNSButton().setToolTip_(
            "Will recalculate the hhea values in the fields to the left. Takes the measurement settings below into account."
        )
        linePos += lineHeight

        self.w.useTypoMetrics = vanilla.CheckBox(
            (inset + 70, linePos, -inset, 20),
            u"Use Typo Metrics (fsSelection bit 7)",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.useTypoMetrics.getNSButton().setToolTip_(
            "Should ALWAYS BE ON. Only uncheck if you really know what you are doing. If unchecked, line behaviour will be not consistent between apps and browsers because some apps prefer win values to sTypo values for determining line distances."
        )
        self.w.useTypoMetricsUpdate = vanilla.SquareButton(
            (inset + 280, linePos, 20, 19),
            u"↺",
            sizeStyle='small',
            callback=self.update)
        self.w.useTypoMetricsUpdate.getNSButton().setToolTip_(
            "Will reset the checkbox to the left to ON, because it should ALWAYS be on. Strongly recommended."
        )
        linePos += lineHeight * 1.5

        self.w.descriptionMeasurements = vanilla.TextBox(
            (inset, linePos + 2, -inset, 14),
            u"Taking Measurements (see tooltips for info):",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

        self.w.round = vanilla.CheckBox((inset, linePos, 70, 20),
                                        u"Round by:",
                                        value=True,
                                        callback=self.SavePreferences,
                                        sizeStyle='small')
        self.w.round.getNSButton().setToolTip_(
            "Turn on if you want your values rounded. Recommended.")
        self.w.roundValue = vanilla.EditText((inset + 75, linePos, 60, 19),
                                             "10",
                                             callback=self.SavePreferences,
                                             sizeStyle='small')
        self.w.roundValue.getNSTextField().setToolTip_(
            "All value calculations will be rounded up to the next multiple of this value. Recommended: 10."
        )
        linePos += lineHeight

        self.w.includeAllMasters = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"Include all masters (otherwise current master only)",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.includeAllMasters.getNSButton().setToolTip_(
            "If checked, all masters will be measured. If unchecked, only the current master will be measured. Since vertical metrics should be the same throughout all masters, it also makes sense to measure on all masters."
        )
        linePos += lineHeight

        self.w.ignoreNonExporting = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"Ignore non-exporting glyphs",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.ignoreNonExporting.getNSButton().setToolTip_(
            "If checked, glyphs that do not export will be excluded from measuring. Recommended. (Ignored for calculating the OS/2 usWin values.)"
        )
        linePos += lineHeight

        self.w.preferSelectedGlyphs = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"Limit to selected glyphs",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.preferSelectedGlyphs.getNSButton().setToolTip_(
            "If checked, only the current glyphs will be measured. Can be combined with the other Limit options. May make sense if you want your metrics to be e.g. Latin-CE-centric."
        )
        linePos += lineHeight

        self.w.preferScript = vanilla.CheckBox(
            (inset, linePos, inset + 110, 20),
            u"Limit to script:",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.preferScript.getNSButton().setToolTip_(
            "If checked, only measures glyphs belonging to the selected writing system. Can be combined with the other Limit options. (Ignored for calculating the OS/2 usWin values.)"
        )
        self.w.preferScriptPopup = vanilla.PopUpButton(
            (inset + 115, linePos + 1, -inset - 25, 17), (u"latin", u"greek"),
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.preferScriptPopup.getNSPopUpButton().setToolTip_(
            "Choose a writing system ('script') you want the measurements to be limited to. May make sense to ignore other scripts if the font is intended only for e.g. Cyrillic."
        )
        self.w.preferScriptUpdate = vanilla.SquareButton(
            (-inset - 20, linePos + 1, -inset, 18),
            u"↺",
            sizeStyle='small',
            callback=self.update)
        self.w.preferScriptUpdate.getNSButton().setToolTip_(
            "Update the script popup to the left with all scripts (writing systems) found in the current font."
        )
        linePos += lineHeight

        self.w.preferCategory = vanilla.CheckBox(
            (inset, linePos, inset + 110, 20),
            u"Limit to category:",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.preferCategory.getNSButton().setToolTip_(
            "If checked, only measures glyphs belonging to the selected glyph category. Can be combined with the other Limit options. (Ignored for calculating the OS/2 usWin values.)"
        )
        self.w.preferCategoryPopup = vanilla.PopUpButton(
            (inset + 115, linePos + 1, -inset - 25, 17),
            (u"Letter", u"Number"),
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.preferCategoryPopup.getNSPopUpButton().setToolTip_(
            "Choose a glyph category you want the measurements to be limited to. It may make sense to limit only to Letter."
        )
        self.w.preferCategoryUpdate = vanilla.SquareButton(
            (-inset - 20, linePos + 1, -inset, 18),
            u"↺",
            sizeStyle='small',
            callback=self.update)
        self.w.preferCategoryUpdate.getNSButton().setToolTip_(
            "Update the category popup to the left with all glyph categories found in the current font."
        )
        linePos += lineHeight

        # Run Button:
        self.w.helpButton = vanilla.HelpButton(
            (inset - 2, -20 - inset, 21, -inset + 2), callback=self.openURL)
        self.w.helpButton.getNSButton().setToolTip_(
            "Opens the Vertical Metrics tutorial (highly recommended) in your web browser."
        )

        self.w.runButton = vanilla.Button(
            (-120 - inset, -20 - inset, -inset, -inset),
            "Apply to Font",
            sizeStyle='regular',
            callback=self.VerticalMetricsManagerMain)
        self.w.runButton.getNSButton().setToolTip_(
            "Insert the OS/2, hhea and fsSelection values above as custom parameters in the font. The number values will be inserted into each master. Blank values will delete the respective parameters."
        )
        self.w.setDefaultButton(self.w.runButton)

        # Load Settings:
        if not self.LoadPreferences():
            print(
                "Note: 'Vertical Metrics Manager' could not load preferences. Will resort to defaults"
            )

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
コード例 #24
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 350
        windowHeight = 270
        windowWidthResize = 100  # user can resize width by this value
        windowHeightResize = 0  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Remove TT Hints",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.RemoveTTHints.mainwindow"  # stores last window position and size
        )

        # UI elements:
        linePos, inset, lineHeight = 12, 15, 22
        column = 160

        self.w.descriptionText = vanilla.TextBox(
            (inset, linePos + 2, 160, 14),
            u"Remove the following hints in",
            sizeStyle='small',
            selectable=True)
        self.w.where = vanilla.PopUpButton((inset + 160, linePos, -inset, 17),
                                           self.wheres,
                                           sizeStyle='small',
                                           callback=self.SavePreferences)
        linePos += lineHeight

        self.w.hStems = vanilla.CheckBox((inset, linePos, column, 20),
                                         u"⬍ H Stem",
                                         value=False,
                                         callback=self.SavePreferences,
                                         sizeStyle='small')
        self.w.vStems = vanilla.CheckBox((inset + column, linePos, -inset, 20),
                                         u"⬌ V Stem",
                                         value=False,
                                         callback=self.SavePreferences,
                                         sizeStyle='small')
        linePos += lineHeight

        self.w.hAnchors = vanilla.CheckBox((inset, linePos, column, 20),
                                           u"⬍ H Anchor",
                                           value=False,
                                           callback=self.SavePreferences,
                                           sizeStyle='small')
        self.w.vAnchors = vanilla.CheckBox(
            (inset + column, linePos, -inset, 20),
            u"⬌ V Anchor",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.hAlign = vanilla.CheckBox((inset, linePos, column, 20),
                                         u"⬍ H Align",
                                         value=False,
                                         callback=self.SavePreferences,
                                         sizeStyle='small')
        self.w.vAlign = vanilla.CheckBox((inset + column, linePos, -inset, 20),
                                         u"⬌ V Align",
                                         value=False,
                                         callback=self.SavePreferences,
                                         sizeStyle='small')
        linePos += lineHeight

        self.w.hInterpolate = vanilla.CheckBox((inset, linePos, column, 20),
                                               u"⬍ H Interpolate",
                                               value=False,
                                               callback=self.SavePreferences,
                                               sizeStyle='small')
        self.w.vInterpolate = vanilla.CheckBox(
            (inset + column, linePos, -inset, 20),
            u"⬌ V Interpolate",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.hDiagonal = vanilla.CheckBox((inset, linePos, column, 20),
                                            u"⬍ H Diagonal",
                                            value=False,
                                            callback=self.SavePreferences,
                                            sizeStyle='small')
        self.w.vDiagonal = vanilla.CheckBox(
            (inset + column, linePos, -inset, 20),
            u"⬌ V Diagonal",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.hDelta = vanilla.CheckBox((inset, linePos, column, 20),
                                         u"⬍ H Delta",
                                         value=False,
                                         callback=self.SavePreferences,
                                         sizeStyle='small')
        self.w.vDelta = vanilla.CheckBox((inset + column, linePos, -inset, 20),
                                         u"⬌ V Delta",
                                         value=False,
                                         callback=self.SavePreferences,
                                         sizeStyle='small')
        linePos += int(lineHeight * 1.2)

        self.w.hON = vanilla.SquareButton((inset, linePos, 40, 18),
                                          u"H on",
                                          sizeStyle='small',
                                          callback=self.update)
        self.w.hOFF = vanilla.SquareButton((inset + 40, linePos, 40, 18),
                                           u"H off",
                                           sizeStyle='small',
                                           callback=self.update)

        self.w.vON = vanilla.SquareButton((inset + column, linePos, 40, 18),
                                          u"V on",
                                          sizeStyle='small',
                                          callback=self.update)
        self.w.vOFF = vanilla.SquareButton(
            (inset + column + 40, linePos, 40, 18),
            u"V off",
            sizeStyle='small',
            callback=self.update)
        linePos += int(lineHeight * 1.2)

        self.w.progress = vanilla.ProgressBar((inset, linePos, -inset, 16))
        self.w.progress.set(0)  # set progress indicator to zero
        linePos += lineHeight

        # Run Button:
        self.w.runButton = vanilla.Button(
            (-100 - inset, -20 - inset, -inset, -inset),
            "Remove",
            sizeStyle='regular',
            callback=self.RemoveTTHintsMain)
        self.w.setDefaultButton(self.w.runButton)

        # Load Settings:
        if not self.LoadPreferences():
            print(
                "Note: 'Remove TT Hints' could not load preferences. Will resort to defaults"
            )

        self.update()

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
コード例 #25
0
	def __init__( self ):
		windowWidth  = 600
		windowHeight = 260
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"BubbleKern", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			autosaveName = "com.Tosche.BubbleKern.mainwindow" # stores last window position and size
		)

		self.w.tabs = vanilla.Tabs((spX, spY, -spX, -spY*2-btnY), ["Pair List Builder", "Flat Text"])
		tab0 = self.w.tabs[0]
		tab0.options = vanilla.PopUpButton((spX, 0, 200, btnY), tab0options, callback=self.optionTasks )
		tab0.options._nsObject.menu().setAutoenablesItems_(False)
		emptyPermutation = [{" ":"", "Left":"", "Right":"", "Add Flipped":"", "Pair Count":"0" }]
		GroupColumnWidth = int((self.w.getPosSize()[2]-180-spX*5-prevX)/2+1)
		tab0.permList = vanilla.List((spX, spY+btnY, -prevX-spX*2, -spY*3), emptyPermutation,
			columnDescriptions=[
				{"title":" ", "width":20},
				{"title":"Left", "width":GroupColumnWidth},
				{"title":"Right", "width":GroupColumnWidth},
				{"title":"Add Flipped","cell":vanilla.CheckBoxListCell(), "width":70},
				{"title":"Pair Count", "width":90}
			],
		#	dragSettings = dict( type=NSString, callback=self.dragCallback ), # WHY DOES THIS THING NOT WORK?
			selfDropSettings=dict(type=toolOrderDragType, operation=NSDragOperationMove, callback=self.dropListSelfCallback),
			allowsMultipleSelection = False,
			selectionCallback = self.permListSelected,
			doubleClickCallback= self.permListDoubleClick,
		)

		tableView = tab0.permList._tableView
		tableView.setAllowsColumnReordering_(False)
		tableView.unbind_("sortDescriptors") # Disables sorting by clicking the title bar
		tableView.tableColumns()[0].setResizingMask_(0)
		tableView.tableColumns()[1].setResizingMask_(1)
		tableView.tableColumns()[2].setResizingMask_(1)
		tableView.tableColumns()[3].setResizingMask_(0)
		tableView.tableColumns()[4].setResizingMask_(0)
		tableView.setColumnAutoresizingStyle_(1)
# setResizingMask_() 0=Fixed, 1=Auto-Resizable (Not user-resizable). There may be more options?
# setColumnAutoresizingStyle accepts value from 0 to 5.
# For detail,see: http://api.monobjc.net/html/T_Monobjc_AppKit_NSTableViewColumnAutoresizingStyle.htm

		tab0.sectionPreview = vanilla.TextBox((-prevX-spX, spY+btnY-2, -spX, txY), "Section Preview", sizeStyle = "small")
		tab0.preview = vanilla.TextEditor((-prevX-spX, spY+btnY+txY, -spX, -spY*3), "", readOnly=True)
		tab0.preview._textView.setFont_( Menlo12 )
		tab0.total = vanilla.TextBox((-prevX-spX*2-75, -spY-txY, 100, txY), "", sizeStyle = "small")
		# Add & Delete Buttons:
		tab0.add = vanilla.SquareButton((spX, -spY*3-1, 30, 20), "+", sizeStyle = 'regular', callback=self.addButton)
		tab0.delete = vanilla.SquareButton((spX+29, -spY*3-1, 30, 20), u"–", sizeStyle = 'regular', callback=self.delButton)

		tab1 = self.w.tabs[1]
		tab1.loadButton = vanilla.Button((spX, 0, 160, btnY), "Load a Text File", callback=self.loadFile)

		tab1.flatPairs = vanilla.TextEditor((spX, spY+btnY, -spX, -spY*3), "", callback=self.refreshPairNum)
		tab1.flatPairs._textView.setFont_( Menlo12 )
		tab1.pairNum = vanilla.TextBox((10, -spY-txY, -10, txY), "", sizeStyle = "small")

		self.w.allButton = vanilla.Button((-spX*2-btnX*2-60, -btnY-spY, btnX, btnY), "Kern All Pairs", sizeStyle='regular', callback=self.BubbleKernMain)
		self.w.selButton = vanilla.Button((-spX-btnX-60, -btnY-spY, btnX+60, btnY), "Kern Pairs with Selected Glyphs", sizeStyle='regular', callback=self.BubbleKernMain )

		# Load Settings:
		if not self.LoadPreferences():
			print "Note: 'BubbleKern' could not load preferences. Will resort to defaults"

		self.refreshTotal()
		self.refreshSectionPreview(0)
		self.refreshPairNum(self.w)
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
コード例 #26
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 300
        windowHeight = 130
        windowWidthResize = 300  # user can resize width by this value
        windowHeightResize = 0  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Remove Anchors",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.AnchorDeleter.mainwindow"  # stores last window position and size
        )

        # UI elements:
        linePos, inset, lineHeight = 12, 13, 20
        self.w.text_1 = vanilla.TextBox((inset - 1, linePos + 2, 80, 14),
                                        "Delete anchor",
                                        sizeStyle='small')
        self.w.updateButton = vanilla.SquareButton(
            (-inset - 20, linePos, -inset, 18),
            u"⟲",
            sizeStyle='small',
            callback=self.updateAnchors)
        self.w.updateButton.getNSButton().setToolTip_(
            u"Scans frontmost font for all available anchors, and updates the pop-up list accordingly. Good idea to do this for every new font you want to process."
        )
        self.w.anchorPopup = vanilla.PopUpButton(
            (inset + 80, linePos, -inset - 25, 17),
            self.updateAnchors(None),
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.anchorPopup.getNSPopUpButton().setToolTip_(
            u"Choose an anchor you want to delete, or choose ‘All Anchors’. Remember to update the list for the current font with the ⟲ update button on the right."
        )
        linePos += lineHeight

        self.w.selectedGlyphsOnly = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            "In selected glyphs only (otherwise all glyphs)",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.selectedGlyphsOnly.getNSButton().setToolTip_(
            u"If checked, the chosen anchor will be deleted in the current glyph selection only. If unchecked, they will be deleted in all glyphs."
        )
        linePos += lineHeight

        self.w.currentMasterOnly = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"In current master only (otherwise all masters)",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.currentMasterOnly.getNSButton().setToolTip_(
            u"If checked, will remove anchor only in layers associated with the currently selected font master. If unchecked, in all layers."
        )
        linePos += lineHeight

        # Run Button:
        self.w.runButton = vanilla.Button(
            (-80 - inset, -20 - inset, -inset, -inset),
            "Remove",
            sizeStyle='regular',
            callback=self.AnchorDeleterMain)
        self.w.setDefaultButton(self.w.runButton)

        # Load Settings:
        if not self.LoadPreferences():
            print(
                "Note: 'Delete Anchors' could not load preferences. Will resort to defaults"
            )

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
コード例 #27
0
    def __init__(self):

        self.debug = False

        # List of theme data dictionaries
        self.themes = []
        # On launch: go ahead and start loading themes
        self.readThemePrefs()
        self.loadDefaultThemes()
        # On launch: hold aside current preferences for "undo"
        self.backupTheme = {}
        self.makeBackupTheme()
        # Build the list of theme names
        self.themeNames = []

        # Placeholder for the name edit sheet
        self.nameSheet = None

        mid = 280
        # The Vanilla window
        self.w = vanilla.Window((300, 560), "Theme Manager")
        # Theme list
        self.w.themeList = vanilla.List(
            (20, 20, mid - 20, 165),
            self.themeNames,
            selectionCallback=self.listSelectionCallback,
            doubleClickCallback=self.listDoubleClickCallback,
            allowsMultipleSelection=False)
        # Editing list
        extrasHeight = len(NONCOLORKEYS) * 25 + 5
        try:
            colorCell = RFColorCell.alloc().initWithDoubleClickCallback_(
                self.colorDoubleClickCallback)
        except:
            colorCell = RFColorCell.alloc().initWithDoubleClickCallack_(
                self.colorDoubleClickCallback)
        columnDescriptions = [
            dict(title="Color", key="color", cell=colorCell, width=90),
            dict(title="Attribute", key="name")
        ]
        self.w.editingList = vanilla.List(
            (mid + 20, 20, 480, -extrasHeight - 20), [],
            columnDescriptions=columnDescriptions,
            allowsEmptySelection=False,
            allowsMultipleSelection=False,
            enableTypingSensitivity=True,
            rowHeight=20,
            allowsSorting=False)
        # Extra values for editing
        self.w.editingExtras = vanilla.Group(
            (mid + 20, -extrasHeight - 10, -20, -20))
        for i, extra in enumerate(NONCOLORKEYS):
            extraKey, extraName, extraType = extra
            extraEditor = vanilla.EditText((20, i * 25, 50, 20),
                                           sizeStyle="small",
                                           callback=self.setThemeExtra)
            extraTitle = vanilla.TextBox((95, i * 25, -20, 20), extraName)
            setattr(self.w.editingExtras, extraKey, extraEditor)
            setattr(self.w.editingExtras, extraKey + "-title", extraTitle)
        # Buttons
        y = 200
        self.w.buttonNewTheme = vanilla.SquareButton(
            (20, y, 31, 25), "✚", callback=self.newThemeCallback)  # ⌫✕✖︎✗✘★✚
        self.w.buttonNewTheme.getNSButton().setToolTip_("New Theme")
        self.w.buttonRemoveTheme = vanilla.SquareButton(
            (50, y, 31, 25), "✘", callback=self.removeThemeCallback)  #✘+
        self.w.buttonRemoveTheme.getNSButton().setToolTip_("Remove Theme")
        self.w.buttonDuplicateTheme = vanilla.SquareButton(
            (80, y, 30, 25), "❏", callback=self.duplicateTheme)
        self.w.buttonDuplicateTheme.getNSButton().setToolTip_(
            "Duplicate Theme")
        self.w.buttonEditTheme = vanilla.SquareButton(
            (250, y, 30, 25), "✑", callback=self.editThemeCallback)
        self.w.buttonEditTheme.getNSButton().setToolTip_("Edit Theme")

        self.w.buttonImport = vanilla.SquareButton(
            (120, y, 61, 25), "Import", callback=self.importThemeCallback)
        self.w.buttonExport = vanilla.SquareButton(
            (180, y, 60, 25), "Export", callback=self.exportThemeCallback)

        self.w.buttonDuplicateTheme.enable(False)
        self.w.buttonRemoveTheme.enable(False)
        # Preview
        y += 40
        self.w.previewGlyphView = GlyphView((20, y, mid - 20, 270))
        self.w.previewGlyphView.setTheme(self.backupTheme)
        self.w.previewGlyphView.setShowOffCurvePoints(True)
        self.w.previewGlyphView.setShowBlues(True)
        # Apply theme
        y += 280
        self.w.applyButton = vanilla.SquareButton(
            (20, y, mid - 60, 25),
            "Apply theme",
            callback=self.applyThemeCallback)
        self.w.applyButton.enable(False)
        self.w.buttonUndo = vanilla.SquareButton(
            (mid - 30, y, 30, 25), "↩︎",
            callback=self.undoThemeCallback)  # ⤺⟲⎌
        self.w.buttonUndo.getNSButton().setToolTip_("Revert Theme")
        self.w.buttonUndo.enable(False)
        # Give the window a callback to call when the window closes
        self.w.bind("close", self.windowClosedCallback)

        # Open the window
        self.w.open()

        self.rebuildThemeList(setList=True)

        # Load the preview font
        previewFontPath = os.path.join(EXTENSIONBUNDLE.resourcesPath(),
                                       "GlyphPreview.ufo")
        previewFont = OpenFont(previewFontPath, showInterface=False)
        previewGlyph = previewFont["a"]
        self.w.previewGlyphView.set(previewGlyph.naked())
コード例 #28
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 350
        windowHeight = 300
        windowWidthResize = 1000  # user can resize width by this value
        windowHeightResize = 0  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Font Info Batch Setter",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.FontInfoBatchSetter.mainwindow"  # stores last window position and size
        )

        # UI elements:
        linePos, inset, lineHeight = 12, 15, 22
        column = 100

        self.w.descriptionText = vanilla.TextBox(
            (inset, linePos + 2, -inset, 14),
            u"Batch-set Font Info > Font of open fonts with these values:",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

        # DESIGNER
        self.w.setDesigner = vanilla.CheckBox((inset, linePos - 1, column, 20),
                                              u"Designer:",
                                              value=True,
                                              callback=self.SavePreferences,
                                              sizeStyle='small')
        self.w.designer = vanilla.EditText(
            (inset + column, linePos, -inset, 19),
            "",
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight
        self.w.setDesignerURL = vanilla.CheckBox(
            (inset, linePos - 1, column, 20),
            u"Designer URL:",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.designerURL = vanilla.EditText(
            (inset + column, linePos, -inset, 19),
            "https://",
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        # MANUFACTURER
        self.w.setManufacturer = vanilla.CheckBox(
            (inset, linePos - 1, column, 20),
            u"Manufacturer:",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.manufacturer = vanilla.EditText(
            (inset + column, linePos, -inset, 19),
            "",
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight
        self.w.setManufacturerURL = vanilla.CheckBox(
            (inset, linePos - 1, column, 20),
            u"Manufact.URL:",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.manufacturerURL = vanilla.EditText(
            (inset + column, linePos, -inset, 19),
            "https://",
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        # COPYRIGHT
        self.w.setCopyright = vanilla.CheckBox(
            (inset, linePos - 1, column, 20),
            u"Copyright:",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.copyright = vanilla.EditText(
            (inset + column, linePos, -inset, 19),
            "",
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        # VERSION NUMBER
        self.w.setVersion = vanilla.CheckBox((inset, linePos - 1, column, 20),
                                             u"Version:",
                                             value=True,
                                             callback=self.SavePreferences,
                                             sizeStyle='small')
        self.w.versionMajor = vanilla.EditText(
            (inset + column, linePos, 50, 19),
            "1",
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.versionDot = vanilla.TextBox((inset + 151, linePos + 2, 8, 18),
                                            u".",
                                            sizeStyle='regular',
                                            selectable=True)
        self.w.versionMinor = vanilla.EditText(
            (inset + 160, linePos, -inset - 113, 19),
            "005",
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.versionMinorDecrease = vanilla.SquareButton(
            (-inset - 110, linePos, -inset - 90, 19),
            u"−",
            sizeStyle='small',
            callback=self.changeMinVersion)
        self.w.versionMinorDecrease.getNSButton().setToolTip_(
            "Decrease the version number by 0.001.")
        self.w.versionMinorIncrease = vanilla.SquareButton(
            (-inset - 91, linePos, -inset - 71, 19),
            u"+",
            sizeStyle='small',
            callback=self.changeMinVersion)
        self.w.versionMinorIncrease.getNSButton().setToolTip_(
            "Increase the version number by 0.001.")
        self.w.minVersionButton = vanilla.SquareButton(
            (-inset - 60, linePos, -inset, 18),
            u"⟳ 1.005",
            sizeStyle='small',
            callback=self.setVersion1005)
        self.w.minVersionButton.getNSButton().setToolTip_(
            u"Resets the version to 1.005. Some (old?) Microsoft apps may consider fonts with smaller versions as unfinished and not display them in their font menu."
        )
        linePos += lineHeight

        # DATE AND TIME
        self.w.setDate = vanilla.CheckBox((inset, linePos - 1, column, 20),
                                          u"Date and time:",
                                          value=True,
                                          callback=self.SavePreferences,
                                          sizeStyle='small')
        self.w.datePicker = vanilla.DatePicker(
            (inset + column, linePos - 3, -inset - 70, 22),
            date=NSDate.alloc().init(),
            minDate=None,
            maxDate=None,
            showStepper=True,
            mode='text',
            timeDisplay='hourMinuteSecond',
            dateDisplay='yearMonthDay',
            callback=None,
            sizeStyle='small')
        self.w.noonButton = vanilla.SquareButton(
            (-inset - 60, linePos, -inset, 18),
            u"🕛 Today",
            sizeStyle='small',
            callback=self.setNoon)
        self.w.noonButton.getNSButton().setToolTip_(
            u"Resets the date to today 12:00 noon.")
        linePos += lineHeight

        # SEPARATOR
        self.w.separator = vanilla.HorizontalLine(
            (inset, linePos + int(lineHeight * 0.5) - 1, -inset, 1))
        linePos += lineHeight

        # APPLY TO FONTS
        self.w.finger = vanilla.TextBox((inset - 5, linePos, 22, 22),
                                        u"👉 ",
                                        sizeStyle='regular',
                                        selectable=True)
        self.w.applyText = vanilla.TextBox((inset + 17, linePos + 2, 70, 14),
                                           u"Apply to",
                                           sizeStyle='small',
                                           selectable=True)
        self.w.applyPopup = vanilla.PopUpButton(
            (inset + 70, linePos, 150, 17),
            (u"ALL open fonts", u"open fonts containing"),
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.applyContaining = vanilla.EditText(
            (inset + 70 + 150 + 10, linePos, -inset, 19),
            "",
            callback=self.SavePreferences,
            sizeStyle='small',
            placeholder="enter part of family name here")
        self.w.applyContaining.getNSTextField().setToolTip_(
            u"Only applies the settings to fonts that contain this in Font Info > Font > Family Name."
        )
        linePos += lineHeight

        # Buttons:
        self.w.extractButton = vanilla.Button(
            (-270 - inset, -20 - inset, -130 - inset, -inset),
            "Extract from Font",
            sizeStyle='regular',
            callback=self.ExtractFontInfoFromFrontmostFont)
        self.w.extractButton.getNSButton().setToolTip_(
            u"Extracts the settings from the frontmost font and fills the UI with it."
        )
        self.w.runButton = vanilla.Button(
            (-120 - inset, -20 - inset, -inset, -inset),
            "Apply to Fonts",
            sizeStyle='regular',
            callback=self.FontInfoBatchSetterMain)
        self.w.runButton.getNSButton().setToolTip_(
            u"Applies the checked settings above to all fonts indicated in the ‘Apply to’ option."
        )
        self.w.setDefaultButton(self.w.runButton)

        # Load Settings:
        if not self.LoadPreferences():
            print(
                "Note: 'Font Info Batch Setter' could not load preferences. Will resort to defaults"
            )

        self.setNoon()
        self.updateUI()

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
コード例 #29
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 355
        windowHeight = 370
        windowWidthResize = 600  # user can resize width by this value
        windowHeightResize = 0  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Straight Stem Cruncher",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.StraightStemCruncher.mainwindow"  # stores last window position and size
        )

        # UI elements:
        linePos, inset, lineHeight = 12, 15, 22
        self.w.descriptionText = vanilla.TextBox(
            (inset, linePos + 2, -inset, 14),
            u"In current master, looks for stems close but not exactly at:",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

        self.w.stemsText = vanilla.TextBox((inset, linePos + 3, 80, 14),
                                           u"Stem Widths:",
                                           sizeStyle='small',
                                           selectable=True)
        self.w.stems = vanilla.EditText((inset + 80, linePos, -inset - 25, 19),
                                        "20, 30, 40",
                                        callback=self.SavePreferences,
                                        sizeStyle='small')
        self.w.stems.getNSTextField().setToolTip_(
            "Comma-separated list of stem sizes to look for. If the script finds stems deviating from these sizes, within the given min/max deviations, it will report them."
        )
        self.w.stemUpdate = vanilla.SquareButton(
            (-inset - 20, linePos, -inset, 19),
            u"↺",
            sizeStyle='small',
            callback=self.update)
        self.w.stemUpdate.getNSButton().setToolTip_(
            "Populate the stems with the stems of the current master.")
        linePos += lineHeight

        self.w.stemFindText = vanilla.TextBox(
            (inset, linePos + 3, 175, 14),
            u"Find deviating stems, min/max:",
            sizeStyle='small',
            selectable=True)
        self.w.deviationMin = vanilla.EditText((inset + 175, linePos, 45, 19),
                                               "0.4",
                                               callback=self.SavePreferences,
                                               sizeStyle='small')
        self.w.deviationMin.getNSTextField().setToolTip_(
            "Deviations up to this value will be tolerated. Half a unit is a good idea to avoid false positives from rounding errors."
        )
        self.w.deviationMax = vanilla.EditText(
            (inset + 175 + 55, linePos, 45, 19),
            "3.1",
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.deviationMax.getNSTextField().setToolTip_(
            "Deviations up to this value will be reported. Do not exaggerate value, otherwise you get false positives from cases where the opposing segment is not the other side of the stem."
        )
        linePos += lineHeight

        self.w.minimumSegmentLengthText = vanilla.TextBox(
            (inset, linePos + 2, 145, 14),
            u"Minimum segment length:",
            sizeStyle='small',
            selectable=True)
        self.w.minimumSegmentLength = vanilla.EditText(
            (inset + 145, linePos, -inset - 25, 19),
            "200",
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.minimumSegmentLength.getNSTextField().setToolTip_(
            "Looks for straight-line segments with at least this length and measures from their center to the opposing segment. Half x-height is a good idea."
        )
        self.w.segmentLengthUpdate = vanilla.SquareButton(
            (-inset - 20, linePos, -inset, 19),
            u"↺",
            sizeStyle='small',
            callback=self.update)
        self.w.segmentLengthUpdate.getNSButton().setToolTip_(
            "Reset to 40% of x-height.")
        linePos += lineHeight

        self.w.checkStemsText = vanilla.TextBox((inset, linePos + 2, 80, 14),
                                                u"Check stems:",
                                                sizeStyle='small',
                                                selectable=True)
        self.w.checkVStems = vanilla.CheckBox(
            (inset + 90, linePos - 1, 65, 20),
            u"Vertical",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.checkHStems = vanilla.CheckBox(
            (inset + 90 + 65, linePos - 1, 80, 20),
            u"Horizontal",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.checkDStems = vanilla.CheckBox(
            (inset + 90 + 65 + 80, linePos - 1, -inset, 20),
            u"Diagonal",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        checkStemsTooltip = "Choose which stems to measure: any combination of these three options. At least one must be active to run the script."
        self.w.checkVStems.getNSButton().setToolTip_(checkStemsTooltip)
        self.w.checkHStems.getNSButton().setToolTip_(checkStemsTooltip)
        self.w.checkDStems.getNSButton().setToolTip_(checkStemsTooltip)
        linePos += lineHeight

        self.w.checkSpecialLayers = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"Also check bracket layers",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.checkSpecialLayers.getNSButton().setToolTip_(
            "If checked, also measures on bracket ayers. Otherwise only on master layers."
        )
        linePos += lineHeight

        self.w.selectedGlyphsOnly = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"Measure selected glyphs only (otherwise all glyphs in font)",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.selectedGlyphsOnly.getNSButton().setToolTip_(
            "Uncheck for measuring complete font.")
        linePos += lineHeight

        self.w.includeNonExporting = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"Include non-exporting glyphs",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.includeNonExporting.getNSButton().setToolTip_(
            "Usually not necessary because the algorithm decomposes and removes overlap first."
        )
        linePos += lineHeight

        self.w.includeCompounds = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"Include components",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.includeCompounds.getNSButton().setToolTip_(
            "If checked, also measures components (after decomposition and removing overlap). If unchecked, only measures outlines."
        )
        linePos += lineHeight

        self.w.excludeGlyphs = vanilla.CheckBox((inset, linePos, 165, 20),
                                                u"Exclude glyphs containing:",
                                                value=False,
                                                callback=self.SavePreferences,
                                                sizeStyle='small')
        self.w.excludeGlyphNames = vanilla.EditText(
            (inset + 165, linePos, -inset - 25, 19),
            self.defaultExcludeList,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.excludeGlyphNames.getNSTextField().setToolTip_(
            "Comma-separated list of glyph name parts (e.g., suffixes). Glyphs containing these will not be measured if checkbox is enabled."
        )
        self.w.excludeGlyphNamesReset = vanilla.SquareButton(
            (-inset - 20, linePos, -inset, 19),
            u"↺",
            sizeStyle='small',
            callback=self.update)
        self.w.excludeGlyphNamesReset.getNSButton().setToolTip_(
            "Reset to: %s." % self.defaultExcludeList)
        linePos += lineHeight

        self.w.markStems = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"Mark affected stems with %s annotation" % self.marker,
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.markStems.getNSButton().setToolTip_(
            u"If checked, will add a red-plus annotation at the center of the measurement. Will often add two of them because stem will be measured from both sides.\nCAREFUL: May delete existing plus annotations."
        )
        linePos += lineHeight

        self.w.reportNonMeasurements = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"Report layers without measurements",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.reportNonMeasurements.getNSButton().setToolTip_(
            "In Macro Window, report if a layer does not have any measurements. Most likely causes: no straight stems in the paths, or wrong path direction."
        )
        linePos += lineHeight

        self.w.openTab = vanilla.CheckBox((inset, linePos, 200, 20),
                                          u"Open tab with affected glyphs",
                                          value=True,
                                          callback=self.SavePreferences,
                                          sizeStyle='small')
        self.w.openTab.getNSButton().setToolTip_(
            "If unchecked, will bring macro window with detailed report to front."
        )
        self.w.reuseTab = vanilla.CheckBox((inset + 200, linePos, -inset, 20),
                                           u"Reuse current tab",
                                           value=True,
                                           callback=self.SavePreferences,
                                           sizeStyle='small')
        self.w.reuseTab.getNSButton().setToolTip_(
            u"If checked, will reuse the active tab if there is one, otherwise will open a new tab. If unchecked, will always open a new tab."
        )
        linePos += lineHeight

        self.w.progress = vanilla.ProgressBar((inset, linePos, -inset, 16))
        self.w.progress.set(0)  # set progress indicator to zero
        linePos += lineHeight

        # Status message:
        self.w.status = vanilla.TextBox((inset, -18 - inset, -120 - inset, 16),
                                        u"🤖 Ready.",
                                        sizeStyle='small',
                                        selectable=True)

        # Run Button:
        self.w.runButton = vanilla.Button(
            (-120 - inset, -20 - inset, -inset, -inset),
            "Measure",
            sizeStyle='regular',
            callback=self.StraightStemCruncherMain)
        self.w.setDefaultButton(self.w.runButton)

        # Load Settings:
        if not self.LoadPreferences():
            print(
                "Note: 'Straight Stem Cruncher' could not load preferences. Will resort to defaults"
            )

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
コード例 #30
0
    def __init__(self):

        self.screenInfo = getScreenInfo()
        self.screenNames = []
        for screen in self.screenInfo:
            for location in ["↖︎", "↗︎"]:
                self.screenNames += ["%s %s" % (location, screen["name"])]
        self.dsPath = None
        self.ds = None

        self.sourceFonts = {}

        step = 10

        self.w = vanilla.Window((660, 600),
                                "Rotated DesignSpace Preview",
                                minSize=(320, 500),
                                autosaveName="Rotated DesignSpace Preview")

        self.w.openButton = vanilla.SquareButton((10, step, 150, 25),
                                                 "Open Designspace",
                                                 sizeStyle="small",
                                                 callback=self.openDesignSpace)
        self.w.reloadButton = vanilla.SquareButton(
            (10, step + 35, 150, 25),
            "Update/Reload Fonts",
            sizeStyle="small",
            callback=self.reloadDesignSpace)
        #self.w.saveButton = vanilla.SquareButton((10, step+70, 40, 25), "Save", sizeStyle="small", callback=self.saveSources)
        self.w.screenChoice = vanilla.PopUpButton(
            (10, step + 65, 150, 25),
            self.screenNames,
            sizeStyle="small",
            callback=self.positionSourceWindows)

        self.w.vr1 = vanilla.VerticalLine((170, 10, 1, 100))

        self.w.glyphNameTitle = vanilla.TextBox((190, step + 5, 100, 25),
                                                "Glyph name:")
        self.w.glyphName = vanilla.EditText((190, step + 35, 100, 25),
                                            "",
                                            callback=self.glyphChanged)
        self.w.fillBox = vanilla.CheckBox((190, step + 65, 100, 25),
                                          "Fill Preview",
                                          callback=self.settingsChanged)

        self.w.vr2 = vanilla.VerticalLine((310, 10, 1, 100))

        mid = 330

        self.w.selectedPointTitle = vanilla.TextBox((mid, step + 5, 100, 25),
                                                    "Selected BCP:")

        self.w.setRatioButton = vanilla.SquareButton(
            (mid, step + 35, 175, 25),
            "Match “default” master ratio...",
            sizeStyle="small",
            callback=self.setPointRatio)
        self.w.setRatioButton.id = "ratio"
        self.w.setRatioButton2 = vanilla.SquareButton(
            (mid + 174, step + 35, 135, 25),
            "...move off-curves only",
            sizeStyle="small",
            callback=self.setPointRatio)
        self.w.setRatioButton2.id = "ratioLeaveAnchor"
        mid = 439
        self.w.magTitle = vanilla.TextBox((mid - 100, step + 70, 100, 25),
                                          "Scale off-curves:",
                                          sizeStyle="small")
        self.w.magButton0 = vanilla.SquareButton(
            (mid, step + 64, 51, 25),
            "-20",
            sizeStyle="small",
            callback=self.pointMagCallback)
        self.w.magButton0.value = 0.8
        self.w.magButton1 = vanilla.SquareButton(
            (mid + 50, step + 64, 51, 25),
            "-5",
            sizeStyle="small",
            callback=self.pointMagCallback)
        self.w.magButton1.value = 0.95
        self.w.magButton2 = vanilla.SquareButton(
            (mid + 100, step + 64, 51, 25),
            "+5",
            sizeStyle="small",
            callback=self.pointMagCallback)
        self.w.magButton2.value = 1.05
        self.w.magButton3 = vanilla.SquareButton(
            (mid + 150, step + 64, 50, 25),
            "+20",
            sizeStyle="small",
            callback=self.pointMagCallback)
        self.w.magButton3.value = 1.2
        #self.w.closeButton = vanilla.SquareButton((550, step+35, 40, 25), "Close", sizeStyle="small", callback=self.closeSourceWindows)

        self.w.hr1 = vanilla.HorizontalLine((10, 110, -10, 1))

        step += 110

        # Sliders
        for tag in ["HROT", "VROT"]:
            posSize = (10, step + 5, 50, 25)
            control = vanilla.TextBox(posSize, tag, sizeStyle="small")
            setattr(self.w, "label_%s" % tag, control)
            posSize = (50, step, 60, 25)
            control = vanilla.EditText(posSize,
                                       0,
                                       callback=self.valueChangedCallback)
            control.id = tag
            setattr(self.w, "value_%s" % tag, control)
            posSize = (120, step, -10, 25)
            control = vanilla.Slider(posSize,
                                     callback=self.sliderChangedCallback,
                                     tickMarkCount=1)
            control.id = tag
            # axis min, max, default
            control.setMinValue(-45)
            control.setMaxValue(45)
            control.set(0)
            setattr(self.w, "slider_%s" % tag, control)
            step += 30

        self.w.glyphPreview = GlyphView((10, step, -10, -10))

        #self.w.bind("close", self.windowClosed)
        self.settingsChanged()
        self.w.open()