Exemplo n.º 1
0
    def __init__(self):
        self.mostImportantObjects = [
            "GSLayer",
            "GSAlignmentZone",
            "GSAnchor",
            "GSAnnotation",
            "GSApplication",
            "GSBackgroundImage",
            "GSClass",
            "GSComponent",
            "GSCustomParameter",
            "GSEditViewController",
            "GSGlyphEditView",
            "GSFeature",
            "GSFeaturePrefix",
            "GSFont",
            "GSFontMaster",
            "GSGlyph",
            "GSGlyphInfo",
            "GSGuideLine",
            "GSHint",
            "GSInstance",
            "GSNode",
            "GSPath",
            "NSBezierPath",
            "NSColor",
            "NSAffineTransform",
            "NSAffineTransformStruct",
            "NSDate",
            "NSImage",
            "NSTextField",
            "NSComboBox",
            "NSPopUpButton",
            "NSButton",
            "FTPointArray",
            "Glyph_g_l_y_f",
        ]

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

        # UI ELEMENTS:

        # Method Picker:
        self.w.objectPicker = vanilla.ComboBox(
            (10, 10, 120, 19),
            self.mostImportantObjects,
            sizeStyle='small',
            completes=True,
            continuous=False,
            callback=self.MethodReporterMain)
        self.w.objectPicker.set("GSLayer")

        # Filter:
        self.w.text2 = vanilla.TextBox((140, 13, 35, 14),
                                       "Filter:",
                                       sizeStyle='small')
        self.w.filter = vanilla.EditText((180, 10, -10, 19),
                                         "",
                                         sizeStyle='small',
                                         callback=self.MethodReporterMain)

        # Listing of methods:
        self.w.methodList = vanilla.List(
            (0, 40, -0, -0),
            dir(GSLayer),
            autohidesScrollers=False,
            drawVerticalLines=True,
            doubleClickCallback=self.copySelection,
            rowHeight=19,
        )
        self.w.methodList.getNSTableView().tableColumns()[0].setWidth_(501)

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

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
        self.MethodReporterMain(None)
Exemplo n.º 2
0
                yTarget = a.y - s.y
            a.x = getItalic(s.x, yTarget, float(w.angle_text.get())) + 26

        else:
            Glyphs.showMacroWindow()
            print "Make a selection!"
    except Exception, e:
        Glyphs.showMacroWindow()
        if selection == ():
            print "Cannot distribute nodes: nothing selected in frontmost layer."
        else:
            print "Error. Cannot distribute nodes:", selection
            print e


w = vanilla.FloatingWindow((300, 130), "Position under the node")
w.anchor_label = vanilla.TextBox((leftMargin, setLineHeight(), 50, 14),
                                 "Anchor:",
                                 sizeStyle='small')
w.anchor_name = vanilla.PopUpButton(
    (leftMargin + 60, setLineHeight() - 4, -leftMargin, 20),
    GetAnchorNames(),
    sizeStyle='small')

w.angle_label = vanilla.TextBox((leftMargin, setLineHeight(1), 0, 14),
                                "Angle",
                                sizeStyle='small')
w.angle_text = vanilla.EditText((leftMargin + 60, setLineHeight(1) - 4, 0, 20),
                                str(Font.selectedFontMaster.italicAngle),
                                sizeStyle='small')
Exemplo n.º 3
0
    def __init__(self):

        # Window 'self.w':
        windowWidth = 360
        windowHeight = 380
        windowWidthResize = 0  # 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
            "Insert weight instances",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.InstanceMaker.mainwindow"  # stores last window position and size
        )
        inset, lineheight = 15, 12

        self.w.text_1 = vanilla.TextBox((inset - 1, lineheight + 2, 75, 14),
                                        "Insert",
                                        sizeStyle='small')
        self.w.numberOfInstances = vanilla.PopUpButton(
            (inset + 40, lineheight, 50, 17), [str(x) for x in range(3, 12)],
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.text_2 = vanilla.TextBox(
            (inset + 40 + 55, lineheight + 2, 120, 14),
            "instances with prefix",
            sizeStyle='small')
        self.w.prefix = vanilla.EditText(
            (inset + 40 + 55 + 120, lineheight - 1, -inset, 19),
            "A-",
            callback=self.UpdateSample,
            sizeStyle='small')
        lineheight += 28

        self.w.text_3 = vanilla.TextBox((inset - 1, lineheight + 2, 60, 14),
                                        "from:",
                                        sizeStyle='small')
        self.w.master1 = vanilla.ComboBox((inset + 35, lineheight - 1, 62, 19),
                                          self.MasterList(1),
                                          callback=self.UpdateSample,
                                          sizeStyle='small')
        self.w.text_4 = vanilla.TextBox(
            (inset + 50 + 55 * 1, lineheight + 2, 55, 14),
            "through:",
            sizeStyle='small')
        self.w.master2 = vanilla.ComboBox(
            (inset + 50 + 55 * 2, lineheight - 1, 62, 19),
            self.MasterList(-1),
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.text_5 = vanilla.TextBox(
            (inset + 65 + 55 * 3, lineheight + 2, 55, 14),
            "at width:",
            sizeStyle='small')
        self.w.width = vanilla.EditText(
            (inset + 65 + 55 * 4, lineheight - 1, -inset, 19),
            "100",
            callback=self.UpdateSample,
            sizeStyle='small')
        lineheight += 28

        self.w.text_6 = vanilla.TextBox((inset - 1, lineheight + 2, 60, 14),
                                        "using",
                                        sizeStyle='small')
        self.w.algorithm = vanilla.PopUpButton(
            (inset + 40, lineheight, 80, 17), ["Pablo", "Luc(as)", "linear"],
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.text_7 = vanilla.TextBox(
            (inset + 40 + 85, lineheight + 2, 110, 14),
            "distribution:",
            sizeStyle='small')
        self.w.help_instances = vanilla.HelpButton(
            (-15 - 21, lineheight + 2, -inset, 20), callback=self.openURL)
        lineheight += 32

        self.w.existingInstances = vanilla.RadioGroup(
            (inset + 30, lineheight, -10, 60), [
                "Leave existing instances as they are",
                "Deactivate existing instances", "Delete existing instances"
            ],
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.existingInstances.set(0)
        lineheight += 70

        self.w.naturalNames = vanilla.CheckBox(
            (inset, lineheight - 1, inset + 230, 19),
            u"Use ‘natural’ weight names, starting at:",
            value=False,
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.firstName = vanilla.PopUpButton(
            (inset + 230, lineheight, -inset, 17),
            naturalNames,
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.firstName.enable(self.w.naturalNames.isEnabled())
        lineheight += 28

        self.w.maciej = vanilla.CheckBox((inset, lineheight - 1, 160, 19),
                                         "Maciej y distribution from:",
                                         value=False,
                                         callback=self.UpdateSample,
                                         sizeStyle='small')
        self.w.text_maciej_1 = vanilla.TextBox(
            (inset + 165 + 55, lineheight + 2, 55, 19),
            "through:",
            sizeStyle='small')
        self.w.text_maciej_2 = vanilla.TextBox(
            (inset + 15, lineheight + 2 + 20, -40, 40),
            "Provide horizontal stem widths in extreme masters to interpolate contrast rather than stems.",
            sizeStyle='small',
            selectable=True)
        self.w.maciej_light = vanilla.ComboBox(
            (inset + 160, lineheight - 1, 55, 19),
            self.MasterList(1),
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.maciej_bold = vanilla.ComboBox(
            (inset + 160 + 55 + 55, lineheight - 1, -inset, 19),
            self.MasterList(-1),
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.help_maciej = vanilla.HelpButton(
            (-inset - 21, lineheight + 6 + 20, -inset, 20),
            callback=self.openURL)
        lineheight += 60

        self.w.shouldRound = vanilla.CheckBox((inset, lineheight, -inset, 19),
                                              "Round all interpolation values",
                                              value=True,
                                              callback=self.UpdateSample,
                                              sizeStyle='small')
        lineheight += 30

        self.w.sample = vanilla.Box((inset, lineheight, -inset, -30 - inset))
        self.w.sample.text = vanilla.TextBox((5, 5, -5, -5),
                                             "",
                                             sizeStyle='small')

        self.w.createButton = vanilla.Button(
            (-80 - inset, -20 - inset, -inset, -inset),
            "Create",
            sizeStyle='regular',
            callback=self.CreateInstances)
        self.w.setDefaultButton(self.w.createButton)

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

        self.w.open()
        self.UpdateSample(self)
        self.w.makeKey()
Exemplo n.º 4
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 350
        windowHeight = 180
        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
            "Replace all Paths with Component",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.ReplaceAllPathsWithComponent.mainwindow"  # stores last window position and size
        )

        # UI elements:
        self.w.text_1 = vanilla.TextBox(
            (15, 12, -15, 14),
            "Replace each path in the current font with component:",
            sizeStyle='small')

        self.w.componentPicker = vanilla.ComboBox(
            (15, 11 + 20, -50, 19), (),
            sizeStyle='small',
            completes=True,
            continuous=False,
            callback=self.SavePreferences)
        self.w.update = vanilla.SquareButton((-40, 12 + 20, -15, 18),
                                             u"↺",
                                             sizeStyle='small',
                                             callback=self.updateCurrentGlyphs)

        self.w.text_2 = vanilla.TextBox((15, 14 + 45, 120, 14),
                                        "Component Position:",
                                        sizeStyle='small')
        self.w.align = vanilla.PopUpButton((140, 12 + 45, -15, 17),
                                           self.alignments,
                                           callback=self.SavePreferences,
                                           sizeStyle='small')

        self.w.onlySelectedGlyphs = vanilla.CheckBox(
            (15, 12 + 70, -15, 30),
            "Replace in selected glyphs only",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.onlyExportingGlyphs = vanilla.CheckBox(
            (15, 12 + 90, -15, 30),
            "Replace in exporting glyphs only",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')

        # Run Button:
        self.w.runButton = vanilla.Button(
            (-80 - 15, -20 - 15, -15, -15),
            "Replace",
            sizeStyle='regular',
            callback=self.ReplaceAllPathsWithComponent)
        self.w.setDefaultButton(self.w.runButton)

        # Load Settings:
        if not self.LoadPreferences():
            print "Note: 'Replace all Paths with Component' could not load preferences. Will resort to defaults"

        self.updateCurrentGlyphs(None)

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
    def __init__(self):
        # Window 'self.w':
        windowWidth = 290
        windowHeight = 250
        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
            "Find Shapeshifting Glyphs",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.FindShapeshiftingGlyphs.mainwindow"  # stores last window position and size
        )

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

        self.w.descriptionText = vanilla.TextBox(
            (inset, linePos + 2, -inset, 28),
            u"Reports glyphs that change number of cw/ccw paths (‘shapeshift’) in interpolation.",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight * 1.7

        self.w.text_1 = vanilla.TextBox((inset, linePos + 2, 85, 14),
                                        "Count paths in",
                                        sizeStyle='small')
        self.w.checkInstances = vanilla.PopUpButton(
            (inset + 85, linePos, -inset, 17),
            ("constructed instances midway between masters",
             "all active instances in font",
             "all active and inactive instances in font"),
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.alsoCheckMasters = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            "Add masters as instances",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.onlyCheckSelection = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            "Limit to selected glyphs (otherwise all glyphs)",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.ignoreGlyphsWithoutPaths = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            "Ignore glyphs without paths",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.ignoreNonexportingGlyphs = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            "Ignore glyphs that do not export",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.openTab = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            "Open found shapeshifters in a new tab",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        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(
            (-80 - inset, -20 - inset, -inset, -inset),
            "Find",
            sizeStyle='regular',
            callback=self.FindShapeshiftingGlyphsMain)
        self.w.setDefaultButton(self.w.runButton)

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

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Exemplo n.º 6
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()
Exemplo n.º 7
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()
Exemplo n.º 8
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 155
        windowHeight = 410
        windowWidthResize = 400  # user can resize width by this value
        windowHeightResize = 100  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Add ttfAutohint Control Instructions for Current Glyph",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.AddTTFAutohintControlInstructionsForCurrentGlyph.mainwindow"  # stores last window position and size
        )

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

        self.w.explanatoryText = vanilla.TextBox(
            (inset, linePos + 2, -inset, 60),
            "Touch instruction with px offset for active glyph & instance, respects italic angle.",
            sizeStyle='small',
            selectable=True)
        linePos += 3 * lineHeight

        sectionOptions = (
            "All Points",
            "Upper Half",
            "Upper Third",
            "Upper Quarter",
            "Lower Half",
            "Lower Third",
            "Lower Quarter",
        )
        self.w.sectionToMoveText = vanilla.TextBox(
            (inset, linePos + 2, 38, 14),
            u"Touch",
            sizeStyle='small',
            selectable=True)
        self.w.sectionToMove = vanilla.PopUpButton(
            (inset + 38, linePos, -inset, 17),
            sectionOptions,
            sizeStyle='small',
            callback=self.SavePreferences)
        linePos += lineHeight

        self.w.runButtonAdd100 = vanilla.Button(
            (inset, linePos, -inset, 20),
            "+1.00",
            sizeStyle='regular',
            callback=self.AddTTFAutohintControlInstructionsForCurrentGlyphMain)
        linePos += lineHeight
        self.w.runButtonAdd075 = vanilla.Button(
            (inset, linePos, -inset, 20),
            "+0.75",
            sizeStyle='regular',
            callback=self.AddTTFAutohintControlInstructionsForCurrentGlyphMain)
        linePos += lineHeight
        self.w.runButtonAdd050 = vanilla.Button(
            (inset, linePos, -inset, 20),
            "+0.50",
            sizeStyle='regular',
            callback=self.AddTTFAutohintControlInstructionsForCurrentGlyphMain)
        linePos += lineHeight
        self.w.runButtonAdd025 = vanilla.Button(
            (inset, linePos, -inset, 20),
            "+0.25",
            sizeStyle='regular',
            callback=self.AddTTFAutohintControlInstructionsForCurrentGlyphMain)
        linePos += lineHeight
        self.w.runButtonSub025 = vanilla.Button(
            (inset, linePos, -inset, 20),
            "-0.25",
            sizeStyle='regular',
            callback=self.AddTTFAutohintControlInstructionsForCurrentGlyphMain)
        linePos += lineHeight
        self.w.runButtonSub050 = vanilla.Button(
            (inset, linePos, -inset, 20),
            "-0.50",
            sizeStyle='regular',
            callback=self.AddTTFAutohintControlInstructionsForCurrentGlyphMain)
        linePos += lineHeight
        self.w.runButtonSub075 = vanilla.Button(
            (inset, linePos, -inset, 20),
            "-0.75",
            sizeStyle='regular',
            callback=self.AddTTFAutohintControlInstructionsForCurrentGlyphMain)
        linePos += lineHeight
        self.w.runButtonSub100 = vanilla.Button(
            (inset, linePos, -inset, 20),
            "-1.00",
            sizeStyle='regular',
            callback=self.AddTTFAutohintControlInstructionsForCurrentGlyphMain)
        linePos += lineHeight

        self.w.ppmText = vanilla.TextBox((inset, linePos + 2, 14, 14),
                                         "@",
                                         sizeStyle='small',
                                         selectable=True)
        self.w.ppm = vanilla.EditText((inset + 14, linePos, -inset, 19),
                                      "8-12,20",
                                      sizeStyle='small',
                                      callback=self.SavePreferences)
        linePos += lineHeight * 1.5

        # self.w.upperHalf = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Upper half (one)", value=False, callback=self.SavePreferences, sizeStyle='small' )
        # linePos += lineHeight

        self.w.rightAtTop = vanilla.Button((inset, linePos, -inset, 20),
                                           "right at top",
                                           sizeStyle='regular',
                                           callback=self.InsertRightAtTop)
        linePos += lineHeight

        self.w.leftAtTop = vanilla.Button((inset, linePos, -inset, 20),
                                          "left at top",
                                          sizeStyle='regular',
                                          callback=self.InsertLeftAtTop)
        linePos += lineHeight

        # Load Settings:
        if not self.LoadPreferences():
            print(
                "Note: 'Add ttfAutohint Control Instructions for Current Glyph' could not load preferences. Will resort to defaults"
            )

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Exemplo n.º 9
0
    def __init__(self):
        linePos, inset, lineHeight = 12, 15, 22

        self.w = vanilla.FloatingWindow(
            (500, 175),
            "Anchor Mover",
            minSize=(350, 175),
            maxSize=(1000, 175),
            autosaveName="com.mekkablue.AnchorMover2.mainwindow")

        self.w.text_1 = vanilla.TextBox((inset, linePos + 2, inset + 60, 14),
                                        "Move anchor",
                                        sizeStyle='small')
        self.w.anchor_name = vanilla.PopUpButton(
            (inset + 75, linePos, -110 - inset - 25, 17),
            self.GetAnchorNames(),
            sizeStyle='small')
        self.w.button = vanilla.SquareButton(
            (-110 - inset - 20, linePos, -110 - inset, 18),
            u"↺",
            sizeStyle='small',
            callback=self.SetAnchorNames)
        self.w.text_2 = vanilla.TextBox((-105 - 15, linePos + 2, -inset, 14),
                                        "in selected glyphs:",
                                        sizeStyle='small')
        linePos += lineHeight

        self.w.hText_1 = vanilla.TextBox((inset - 2, linePos, 20, 14),
                                         u"↔",
                                         sizeStyle='regular')
        self.w.hText_2 = vanilla.TextBox((inset + 20, linePos + 2, 20, 14),
                                         "to",
                                         sizeStyle='small')
        self.w.hTarget = vanilla.PopUpButton(
            (inset + 40, linePos, -50 - 15 - 15 - inset, 17),
            [x[0] for x in listHorizontal],
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.hText_3 = vanilla.TextBox(
            (-60 - 15 - 15, linePos + 2, -50 - inset, 14),
            "+",
            sizeStyle='small')
        self.w.hChange = vanilla.EditText((-60 - 15, linePos, -inset, 19),
                                          "0.0",
                                          sizeStyle='small',
                                          callback=self.SavePreferences)
        linePos += lineHeight

        self.w.vText_1 = vanilla.TextBox((inset, linePos, 20, 14),
                                         u"↕",
                                         sizeStyle='regular')
        self.w.vText_2 = vanilla.TextBox((inset + 20, linePos + 2, 20, 14),
                                         "to",
                                         sizeStyle='small')
        self.w.vTarget = vanilla.PopUpButton(
            (inset + 40, linePos, -50 - 15 - 15 - inset, 17),
            [y[0] for y in listVertical],
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.vText_3 = vanilla.TextBox(
            (-60 - 15 - 15, linePos + 2, -50 - inset, 14),
            "+",
            sizeStyle='small')
        self.w.vChange = vanilla.EditText((-60 - 15, linePos, -inset, 19),
                                          "0.0",
                                          sizeStyle='small',
                                          callback=self.SavePreferences)
        linePos += lineHeight

        self.w.italic = vanilla.CheckBox((inset, linePos, -inset, 18),
                                         "Respect italic angle",
                                         value=True,
                                         sizeStyle='small',
                                         callback=self.SavePreferences)
        linePos += lineHeight

        self.w.allMasters = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"All masters and special layers (otherwise only current masters)",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        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()
        self.w.makeKey()
Exemplo n.º 10
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 280
        windowHeight = 155
        windowWidthResize = 120  # 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
            "Copy layer to layer",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.MasterFiller.mainwindow"  # stores last window position and size
        )

        self.w.text_1 = vanilla.TextBox((15, 12 + 2, 120, 14),
                                        "Copy paths from",
                                        sizeStyle='small')
        self.w.master_from = vanilla.PopUpButton(
            (120, 12, -15, 17),
            self.GetMasterNames(),
            sizeStyle='small',
            callback=self.MasterChangeCallback)

        self.w.text_2 = vanilla.TextBox((15, 32 + 2, 120, 14),
                                        "into selection of",
                                        sizeStyle='small')
        self.w.master_into = vanilla.PopUpButton(
            (120, 32, -15, 17),
            self.GetMasterNames(),
            sizeStyle='small',
            callback=self.MasterChangeCallback)

        self.w.include_components = vanilla.CheckBox(
            (15, 52 + 2, -100, 20),
            "Include components",
            sizeStyle='small',
            callback=self.SavePreferences,
            value=True)
        self.w.include_anchors = vanilla.CheckBox(
            (15, 52 + 20, -100, 20),
            "Include anchors",
            sizeStyle='small',
            callback=self.SavePreferences,
            value=True)
        self.w.include_metrics = vanilla.CheckBox(
            (15, 52 + 38, -100, 20),
            "Include metrics",
            sizeStyle='small',
            callback=self.SavePreferences,
            value=True)
        self.w.keep_window_open = vanilla.CheckBox(
            (15, 52 + 56, -100, 20),
            "Keep window open",
            sizeStyle='small',
            callback=self.SavePreferences,
            value=True)

        self.w.copybutton = vanilla.Button((-80, -30, -15, -10),
                                           "Copy",
                                           sizeStyle='small',
                                           callback=self.buttonCallback)
        self.w.setDefaultButton(self.w.copybutton)

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

        self.w.open()
        self.w.makeKey()
        self.w.master_into.set(1)
    def __init__(self):
        # Window 'self.w':
        windowWidth = 290
        windowHeight = 200
        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
            "Find and Replace in Font Info",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.FindAndReplaceInFontInfo.mainwindow"  # stores last window position and size
        )

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

        self.w.searchForText = vanilla.TextBox((inset, linePos + 2, 80, 14),
                                               "Search for:",
                                               sizeStyle='small',
                                               selectable=True)
        self.w.searchFor = vanilla.EditText(
            (inset + 80, linePos - 1, -inset, 19),
            "",
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.replaceWithText = vanilla.TextBox((inset, linePos + 2, 80, 14),
                                                 "Replace with:",
                                                 sizeStyle='small',
                                                 selectable=True)
        self.w.replaceWith = vanilla.EditText(
            (inset + 80, linePos - 1, -inset, 19),
            "",
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.completeWordsOnly = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            "Complete words only",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.allFonts = vanilla.CheckBox((inset, linePos, -inset, 20),
                                           "⚠️ Include all open fonts",
                                           value=False,
                                           callback=self.SavePreferences,
                                           sizeStyle='small')
        linePos += lineHeight

        self.w.includeInstances = vanilla.CheckBox(
            (inset, linePos, 120, 20),
            "Include instances",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.includeInactiveInstances = vanilla.CheckBox(
            (inset + 120, linePos, -inset, 20),
            "Also inactive instances",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.includeCustomParameters = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            "Include Custom Parameters",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

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

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

        # Open window and focus on it:
        self.updateUI()
        self.w.open()
        self.w.makeKey()
Exemplo n.º 12
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 320
		windowHeight = 490
		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
			"Find Near Vertical Misses", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.FindNearVerticalMisses.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"Find glyphs with nodes not exactly on vertical metrics:", sizeStyle='small', selectable=True )
		linePos += lineHeight
		
		self.w.devianceText = vanilla.TextBox( (inset, linePos+3, inset+135, 14), u"Find nodes off by up to:", sizeStyle='small', selectable=True )
		self.w.deviance = vanilla.EditText( (inset+135, linePos, -inset, 19), "1", callback=self.SavePreferences, sizeStyle='small' )
		self.w.deviance.getNSTextField().setToolTip_(u"Finds nodes that are not equal to the metric, but off up to this value in units. Minimum: 1 unit.")
		linePos += lineHeight
		
		# BOX
		linePos += lineHeight//2
		self.w.whereToCheck = vanilla.Box( (inset, linePos, -inset, lineHeight*7.6) )
		insetLinePos = inset*0.2
		
		self.w.whereToCheck.ascender = vanilla.CheckBox( (0.5*inset, insetLinePos-1, -inset, 20), u"Ascender (caps ignored)", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.whereToCheck.ascender.getNSButton().setToolTip_(u"Checks if points are not exactly on, but just off the ascender of the corresponding master.")
		linePos += lineHeight
		insetLinePos += lineHeight
		
		self.w.whereToCheck.capHeight = vanilla.CheckBox( (0.5*inset, insetLinePos-1, -inset, 20), u"Cap Height (lowercase ignored)", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.whereToCheck.capHeight.getNSButton().setToolTip_(u"Checks if points are not exactly on, but just off the capHeight of the corresponding master.")
		linePos += lineHeight
		insetLinePos += lineHeight
		
		self.w.whereToCheck.shoulderHeight = vanilla.CheckBox( (0.5*inset, insetLinePos-1, -inset, 20), u"shoulderHeight (UC, LC, SC ignored)", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.whereToCheck.shoulderHeight.getNSButton().setToolTip_(u"Checks if points are not exactly on, but just off the shoulderHeight of the corresponding master.")
		linePos += lineHeight
		insetLinePos += lineHeight
		
		self.w.whereToCheck.smallCapHeight = vanilla.CheckBox( (0.5*inset, insetLinePos-1, -inset, 20), u"smallCapHeight (only considers smallcaps)", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.whereToCheck.smallCapHeight.getNSButton().setToolTip_(u"Checks if points are not exactly on, but just off the smallCapHeight of the corresponding master.")
		linePos += lineHeight
		insetLinePos += lineHeight
		
		self.w.whereToCheck.xHeight = vanilla.CheckBox( (0.5*inset, insetLinePos-1, -inset, 20), u"x-height (caps ignored)", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.whereToCheck.xHeight.getNSButton().setToolTip_(u"Checks if points are not exactly on, but just off the xHeight of the corresponding master.")
		linePos += lineHeight
		insetLinePos += lineHeight
		
		self.w.whereToCheck.baseline = vanilla.CheckBox( (0.5*inset, insetLinePos-1, -inset, 20), u"Baseline", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.whereToCheck.baseline.getNSButton().setToolTip_(u"Checks if points are not exactly on, but just off the baseline of the corresponding master.")
		linePos += lineHeight
		insetLinePos += lineHeight
		
		self.w.whereToCheck.descender = vanilla.CheckBox( (0.5*inset, insetLinePos-1, -inset, 20), u"Descender", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.whereToCheck.descender.getNSButton().setToolTip_(u"Checks if points are not exactly on, but just off the descender of the corresponding master.")
		linePos += lineHeight
		insetLinePos += lineHeight
		
		linePos += lineHeight
		# BOX END
		
		self.w.tolerateIfNextNodeIsOn = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Tolerate near miss if next node is on", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.tolerateIfNextNodeIsOn.getNSButton().setToolTip_("Will skip the just-off node if the next or previous on-curve node is EXACTLY on the metric line. Useful if you have very thin serifs or short segments near the metric lines.")
		linePos += lineHeight
		
		self.w.tolerateIfExtremum = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Tolerate near miss for left/right curve extremum", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.tolerateIfExtremum.getNSButton().setToolTip_("Will skip the just-off node if the next and previous nodes are VERTICAL OFF-CURVES. Recommended for avoiding false positives.")
		linePos += lineHeight
		
		
		self.w.includeHandles = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Include off-curve points", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.includeHandles.getNSButton().setToolTip_(u"Also checks BCPs (Bézier control points), vulgo ‘handles’. Otherwise only considers on-curve nodes")
		linePos += lineHeight
		
		self.w.includeNonExporting = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Include non-exporting glyphs", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.includeNonExporting.getNSButton().setToolTip_(u"Also check for near misses in glyphs that are set to not export. Useful if you are using non-exporting parts as components in other glyphs.")
		linePos += lineHeight
		
		self.w.removeOverlap = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Check outlines after Remove Overlap (slower)", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.removeOverlap.getNSButton().setToolTip_(u"Only checks outlines after overlap removal. That way, ignores triangular overlaps (‘opened corners’). Use this option if you have too many false positives.")
		linePos += lineHeight
		
		
		self.w.markNodes = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Mark affected nodes with %s"%self.marker, value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.markNodes.getNSButton().setToolTip_(u"Sets the name of affected nodes to this emoji, so you can easily find it. ATTENTION: If Remove Overlap option is on, will use the emoji as an annotation instead.")
		linePos += lineHeight
		
		
		self.w.excludeText = vanilla.TextBox( (inset, linePos+3, 150, 14), u"Exclude glyphs containing:", sizeStyle='small', selectable=True )
		self.w.exclude = vanilla.EditText( (inset+150, linePos, -inset, 19), ".ornm, .notdef", callback=self.SavePreferences, sizeStyle='small' )
		linePos += lineHeight
		
		self.w.openTab = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Open tab with affected layers", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.openTab.getNSButton().setToolTip_(u"If it finds nodes just off the indicated metrics, will open a new tab with the layers if found the deviating nodes on. Otherwise please check the detailed report in Macro Window.")
		linePos += lineHeight
		
		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( (-80-inset, -20-inset, -inset, -inset), "Find", sizeStyle='regular', callback=self.FindNearVerticalMissesMain )
		self.w.setDefaultButton( self.w.runButton )
		
		# Load Settings:
		if not self.LoadPreferences():
			print "Note: 'Find Near Vertical Misses' could not load preferences. Will resort to defaults"
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
Exemplo n.º 13
0
    def __init__(self):

        self.methods = {
            0: "fl",
            1: "thirds",
            2: "quad",
            3: "adjust",
            4: "free",
            5: "hobby",
        }

        self.methodNames = [
            "Circle",
            "Rule of thirds",
            "TT (experimental)",
            "Adjust fixed:",
            "Adjust free:",
            "Hobby:",
        ]

        self.curvatures = {
            0: 0.552,
            1: 0.577,
            2: 0.602,
            3: 0.627,
            4: 0.652,
        }

        height = 182

        self.w = vanilla.FloatingWindow((200, height), "Curve EQ")

        y = 8
        self.w.eqMethodSelector = vanilla.RadioGroup(
            (10, y, -10, 140),
            titles=self.methodNames,
            callback=self._changeMethod,
            sizeStyle="small")

        y -= 109
        self.w.eqCurvatureSelector = vanilla.RadioGroup(
            (104, y, -8, 14),
            isVertical=False,
            titles=["", "", "", "", ""],
            callback=self._changeCurvature,
            sizeStyle="small")

        y += 21
        self.w.eqCurvatureSlider = vanilla.Slider(
            (104, y, -8, 17),
            callback=self._changeCurvatureFree,
            minValue=0.5,
            maxValue=1.0,
            #value=self.curvatures[self.w.eqCurvatureSelector.get()],
            sizeStyle="small",
        )

        y += 27
        self.w.eqHobbyTensionSlider = vanilla.Slider(
            (104, y, -8, 17),
            tickMarkCount=5,
            callback=self._changeTension,
            minValue=0.5,
            maxValue=1.0,
            sizeStyle="small",
        )

        y = height - 32
        self.w.eqSelectedButton = vanilla.Button(
            (10, y, -10, 25),
            "Equalize selected",
            callback=self._eqSelected,
            sizeStyle="small",
        )

        # default method
        self.w.eqMethodSelector.set(
            getExtensionDefault("%s.%s" % (extensionID, "method"), 0))
        self.method = self.methods[self.w.eqMethodSelector.get()]
        self._checkSecondarySelectors()

        # default curvature
        self.w.eqCurvatureSelector.set(
            getExtensionDefault("%s.%s" % (extensionID, "curvature"), 0))
        self.curvature = self.curvatures[self.w.eqCurvatureSelector.get()]

        # default curvature for slider
        self.w.eqCurvatureSlider.set(
            getExtensionDefault("%s.%s" % (extensionID, "curvatureFree"), 0.5))
        self.curvatureFree = self.w.eqCurvatureSlider.get()

        # default curvature for Hobby's spline tension slider
        self.w.eqHobbyTensionSlider.set(
            getExtensionDefault("%s.%s" % (extensionID, "tension"), 0.5))
        self.tension = self.w.eqHobbyTensionSlider.get()

        addObserver(self, "_curvePreview", "draw")
        addObserver(self, "_curvePreview", "drawInactive")
        addObserver(self, "_currentGlyphChanged", "currentGlyphChanged")

        self.tmp_glyph = RGlyph()
        #self._currentGlyphChanged({"glyph": CurrentGlyph()})
        UpdateCurrentGlyphView()

        self.setUpBaseWindowBehavior()
        self.w.open()
Exemplo n.º 14
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 250
        windowHeight = 240
        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
            "New Tab with Small Paths",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.FindSmallPaths.mainwindow"  # stores last window position and size
        )

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

        self.w.text_1 = vanilla.TextBox(
            (inset, linePos, -inset, 30),
            u"Open new tab with glyphs that contain paths with an area smaller than:",
            sizeStyle='small')
        linePos += lineHeight * 1.7

        self.w.minArea = vanilla.TextBox((inset, linePos, -inset, 15 + 3),
                                         u"1000 square units",
                                         sizeStyle='small',
                                         alignment="center")
        linePos += lineHeight

        self.w.sliderMin = vanilla.EditText((inset, linePos, 50, 19),
                                            "10",
                                            sizeStyle='small',
                                            callback=self.SliderUpdate)
        self.w.sliderMax = vanilla.EditText((-inset - 50, linePos, -inset, 19),
                                            "10000",
                                            sizeStyle='small',
                                            callback=self.SliderUpdate)
        self.w.areaSlider = vanilla.Slider(
            (inset + 50 + 10, linePos, -inset - 50 - 10, 19),
            value=0.1,
            minValue=0.0,
            maxValue=1.0,
            sizeStyle='small',
            callback=self.SliderUpdate)
        linePos += lineHeight

        self.w.deleteThemRightAway = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"Delete Small Paths Right Away",
            value=False,
            callback=self.CheckBoxUpdate,
            sizeStyle='small')
        linePos += lineHeight

        self.w.afterOverlapRemoval = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"After Decomposition and Overlap Removal (slower)",
            value=True,
            callback=self.CheckBoxUpdate,
            sizeStyle='small')
        linePos += lineHeight

        self.w.allFonts = vanilla.CheckBox((inset, linePos, -inset, 20),
                                           u"Apply to all open fonts",
                                           value=False,
                                           callback=self.SavePreferences,
                                           sizeStyle='small')
        linePos += lineHeight

        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((-120, -20 - inset, -inset, -inset),
                                          u"Open Tab",
                                          sizeStyle='regular',
                                          callback=self.FindSmallPathsMain)
        self.w.setDefaultButton(self.w.runButton)

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

        self.CheckBoxUpdate(None)
        self.SliderUpdate(None)

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Exemplo n.º 15
0
    def __init__(self):

        # Window 'self.w':
        windowWidth = 360
        windowHeight = 390
        windowWidthResize = 0  # 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
            "Insert weight instances",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.InstanceMaker.mainwindow"  # stores last window position and size
        )
        inset, lineheight = 15, 12

        self.w.text_1 = vanilla.TextBox((inset - 1, lineheight + 2, 75, 14),
                                        "Insert",
                                        sizeStyle='small')
        self.w.numberOfInstances = vanilla.PopUpButton(
            (inset + 40, lineheight, 50, 17), [str(x) for x in range(3, 12)],
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.numberOfInstances.getNSPopUpButton().setToolTip_(
            "Choose how many instances you want to add. A full weight spectrum has 9 weights."
        )
        self.w.text_2 = vanilla.TextBox(
            (inset + 40 + 55, lineheight + 2, 120, 14),
            "instances with prefix",
            sizeStyle='small')
        self.w.prefix = vanilla.EditText(
            (inset + 40 + 55 + 120, lineheight - 1, -inset, 19),
            "A-",
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.prefix.getNSTextField().setToolTip_(
            u"Choose text that is added at the beginning of each instance, e.g., ‘Condensed’."
        )
        lineheight += 28

        self.w.text_3 = vanilla.TextBox((inset - 1, lineheight + 2, 60, 14),
                                        "from:",
                                        sizeStyle='small')
        self.w.master1 = vanilla.ComboBox((inset + 35, lineheight - 1, 62, 19),
                                          self.MasterList(1),
                                          callback=self.UpdateSample,
                                          sizeStyle='small')
        self.w.master1.getNSComboBox().setToolTip_(
            "Weight value for the first instance being added, typically the stem width of your lightest weight."
        )
        self.w.text_4 = vanilla.TextBox(
            (inset + 50 + 55 * 1, lineheight + 2, 55, 14),
            "through:",
            sizeStyle='small')
        self.w.master2 = vanilla.ComboBox(
            (inset + 50 + 55 * 2, lineheight - 1, 62, 19),
            self.MasterList(-1),
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.master2.getNSComboBox().setToolTip_(
            "Weight value for the last instance being added, typically the stem width of your boldest weight."
        )
        self.w.text_5 = vanilla.TextBox(
            (inset + 65 + 55 * 3, lineheight + 2, 55, 14),
            "at width:",
            sizeStyle='small')
        self.w.width = vanilla.EditText(
            (inset + 65 + 55 * 4, lineheight - 1, -inset, 19),
            "100",
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.width.getNSTextField().setToolTip_(
            "The Width value for the instances being added. Default is 100. Adapt accordingly if you are adding condensed or extended instances."
        )
        lineheight += 28

        self.w.text_6 = vanilla.TextBox((inset - 1, lineheight + 2, 60, 14),
                                        "using",
                                        sizeStyle='small')
        self.w.algorithm = vanilla.PopUpButton(
            (inset + 35, lineheight, 90, 17),
            ("linear", "Pablo", "Schneider", "Abraham", "Luc(as)"),
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.algorithm.getNSPopUpButton().setToolTip_(
            "The way the Weight values are distributed between the first and last master values you entered above. Linear means equal steps between instances. Luc(as) means the same growth percentage between instances. Pablo is like Luc(as) at first, then becomes increasingly linear, i.e., flat in the periphery and steep in the middle. Schneider is half way between Pablo and Luc(as). Abraham is linear at first, then becomes incresingly like Luc(as), i.e. steep in the periphery, flat in the middle.\nFor a wide spectrum, pick Pablo, Abraham or Schneider. Luc(as) distribution tends to have large jumps at the end. Large jumps are usually found in the center of the weight spectrum (between Regular and Semibold). Small jumps are preferable in the periphery, i.e., for very light and very dark weights."
        )
        self.w.text_7 = vanilla.TextBox(
            (inset + 40 + 85 + 5, lineheight + 2, 110, 14),
            "distribution.",
            sizeStyle='small')
        self.w.help_instances = vanilla.HelpButton(
            (-15 - 21, lineheight + 2, -inset, 20), callback=self.openURL)
        lineheight += 32

        self.w.existingInstances = vanilla.RadioGroup(
            (inset + 20, lineheight, -10, 60),
            ("Leave existing instances as they are",
             "Deactivate existing instances", "Delete existing instances"),
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.existingInstances.set(0)
        lineheight += 70

        self.w.naturalNames = vanilla.CheckBox(
            (inset, lineheight, inset + 225, 19),
            u"Use ‘natural’ weight names, starting at:",
            value=False,
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.naturalNames.getNSButton().setToolTip_(
            "Prefill with standard names and style linking. If turned off, will use the Weight number as instance name."
        )
        self.w.firstName = vanilla.PopUpButton(
            (inset + 225, lineheight, -inset, 17),
            naturalNames,
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.firstName.getNSPopUpButton().setToolTip_(
            "If you use natural weight names, choose here the name of your lightest weight."
        )
        try:  # workaround for macOS 10.9
            self.w.firstName.enable(
                self.w.naturalNames.getNSButton().isEnabled())
        except:
            pass
        lineheight += 20

        self.w.italicStyle = vanilla.CheckBox(
            (inset + 20, lineheight, -inset, 20),
            u"Italic suffixes and style linking",
            value=False,
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.italicStyle.getNSButton().setToolTip_(
            u"If enabled, will add the word ‘Italic’ to all instances, and also add italic style linking."
        )
        lineheight += 24

        self.w.maciej = vanilla.CheckBox((inset, lineheight - 1, 160, 19),
                                         "Maciej y distribution from:",
                                         value=False,
                                         callback=self.UpdateSample,
                                         sizeStyle='small')
        self.w.maciej.getNSButton().setToolTip_(
            "An algorithm proposed by Maciej Ratajski, which introduces slightly different interpolation for y coordinates. Will add interpolationWeightY parameters to the instances. If these value differ greatly from the weight interpolation values, interpolation of your diagonals may suffer."
        )
        self.w.text_maciej_1 = vanilla.TextBox(
            (inset + 165 + 55, lineheight + 2, 55, 19),
            "through:",
            sizeStyle='small')
        self.w.text_maciej_2 = vanilla.TextBox(
            (inset + 15, lineheight + 2 + 20, -40, 40),
            "Provide horizontal stem widths in extreme masters to interpolate contrast rather than stems.",
            sizeStyle='small',
            selectable=True)
        self.w.maciej_light = vanilla.ComboBox(
            (inset + 160, lineheight - 1, 55, 19),
            self.MasterList(1),
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.maciej_bold = vanilla.ComboBox(
            (inset + 160 + 55 + 55, lineheight - 1, -inset, 19),
            self.MasterList(-1),
            callback=self.UpdateSample,
            sizeStyle='small')
        self.w.help_maciej = vanilla.HelpButton(
            (-inset - 21, lineheight + 6 + 20, -inset, 20),
            callback=self.openURL)
        self.w.help_maciej.getNSButton().setToolTip_(
            "Will open a website with a detailed description of the Maciej algorithm. Requires an internet connection."
        )
        lineheight += 60

        self.w.shouldRound = vanilla.CheckBox((inset, lineheight, -inset, 19),
                                              "Round all interpolation values",
                                              value=True,
                                              callback=self.UpdateSample,
                                              sizeStyle='small')
        self.w.shouldRound.getNSButton().setToolTip_(
            "If enabled, will round all calculated weight values to integers. Usually a good idea."
        )
        lineheight += 30

        self.w.sample = vanilla.Box((inset, lineheight, -inset, -30 - inset))
        self.w.sample.text = vanilla.TextBox((5, 5, -5, -5),
                                             "",
                                             sizeStyle='small')

        self.w.createButton = vanilla.Button(
            (-90 - inset, -20 - inset, -inset, -inset),
            "Insert",
            sizeStyle='regular',
            callback=self.CreateInstances)
        self.w.setDefaultButton(self.w.createButton)

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

        self.w.open()
        self.UpdateSample(self)
        self.w.makeKey()
Exemplo n.º 16
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 400
        windowHeight = 260
        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
            "Spacing Checker",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.SpacingChecker.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),
            "Find glyphs with unusual sidebearings. Open tab with glyphs where:",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

        self.w.asymmetricSBs = vanilla.CheckBox((inset, linePos, -inset, 20),
                                                "LSB & RSB differ more than:",
                                                value=False,
                                                callback=self.SavePreferences,
                                                sizeStyle='small')
        self.w.asymmetricDifference = vanilla.EditText(
            (inset + 170, linePos, -inset - 35, 19),
            "50",
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.asymmetricUpdateButton = vanilla.SquareButton(
            (-inset - 30, linePos + 0.5, -inset, 18),
            u"↺ K",
            sizeStyle='small',
            callback=self.updateValues)
        self.w.asymmetricUpdateButton.getNSButton().setToolTip_(
            "Update the entry with the measurements for uppercase K, presumably the largest difference in most designs."
        )
        linePos += lineHeight

        self.w.largeLSB = vanilla.CheckBox((inset, linePos, -inset, 20),
                                           "LSBs larger than:",
                                           value=False,
                                           callback=self.SavePreferences,
                                           sizeStyle='small')
        self.w.lsbThreshold = vanilla.EditText(
            (inset + 110, linePos, -inset - 35, 19),
            "70",
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.lsbThresholdUpdateButton = vanilla.SquareButton(
            (-inset - 30, linePos + 0.5, -inset, 18),
            u"↺ H",
            sizeStyle='small',
            callback=self.updateValues)
        self.w.lsbThresholdUpdateButton.getNSButton().setToolTip_(
            "Update the entry with the measurements for uppercase H, presumably the largest LSB in most designs."
        )
        linePos += lineHeight

        self.w.largeRSB = vanilla.CheckBox((inset, linePos, -inset, 20),
                                           "RSBs larger than:",
                                           value=False,
                                           callback=self.SavePreferences,
                                           sizeStyle='small')
        self.w.rsbThreshold = vanilla.EditText(
            (inset + 110, linePos, -inset - 35, 19),
            "70",
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.rsbThresholdUpdateButton = vanilla.SquareButton(
            (-inset - 30, linePos + 0.5, -inset, 18),
            u"↺ H",
            sizeStyle='small',
            callback=self.updateValues)
        self.w.rsbThresholdUpdateButton.getNSButton().setToolTip_(
            "Update the entry with the measurements for uppercase H, presumably the largest RSB in most designs."
        )
        linePos += lineHeight

        self.w.whiteGlyphs = vanilla.CheckBox((inset, linePos, 180, 20),
                                              "LSB+RSB make up more than:",
                                              value=False,
                                              callback=self.SavePreferences,
                                              sizeStyle='small')
        self.w.whitePercentage = vanilla.EditText(
            (inset + 180, linePos, -inset - 100, 19),
            "50",
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.whiteGlyphsText = vanilla.TextBox(
            (-inset - 100, linePos + 3, -inset, 14),
            "% of overall width",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

        self.w.includeBraceAndBracketLayers = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            "Include brace and bracket layers",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.allMasters = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            "Look on all masters (otherwise current master only)",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.ignoreNonexportingGlyphs = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            "Ignore glyphs that do not export",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        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(
            (-120 - inset, -20 - inset, -inset, -inset),
            "Open Tab",
            sizeStyle='regular',
            callback=self.SpacingCheckerMain)
        self.w.setDefaultButton(self.w.runButton)

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

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Exemplo n.º 17
0
    def __init__(self):
        windowHeight = 180
        self.w = vanilla.FloatingWindow(
            (350, windowHeight),
            "Stitcher",
            minSize=(300, windowHeight),
            maxSize=(500, windowHeight),
            autosaveName="com.mekkablue.ComponentsOnNodes.mainwindow")

        inset = 15
        linePos = 14
        lineGap = 22
        self.w.text_1 = vanilla.TextBox((inset, linePos, 100, 14),
                                        "Place component:",
                                        sizeStyle='small')
        self.w.componentName = vanilla.EditText(
            (inset + 100, linePos, -15, 20),
            "_circle",
            sizeStyle='small',
            callback=self.SavePreferences)

        linePos += lineGap
        self.w.text_2 = vanilla.TextBox((inset, linePos, 15 + 95, 14),
                                        "At intervals of:",
                                        sizeStyle='small')
        self.w.sliderMin = vanilla.EditText((inset + 100, linePos, 50, 20),
                                            "30",
                                            sizeStyle='small',
                                            callback=self.SavePreferences)
        self.w.sliderMax = vanilla.EditText((-inset - 50, linePos, -15, 20),
                                            "60",
                                            sizeStyle='small',
                                            callback=self.SavePreferences)
        self.w.intervalSlider = vanilla.Slider(
            (inset + 100 + 50 + 10, linePos, -inset - 50 - 10, 20),
            value=0,
            minValue=0.0,
            maxValue=1.0,
            sizeStyle='small',
            callback=self.ComponentOnLinesMain)

        linePos += lineGap
        self.w.liveSlider = vanilla.CheckBox((inset, linePos, -inset, 20),
                                             "Live slider",
                                             value=False,
                                             sizeStyle='small')

        linePos += lineGap
        self.w.useBackground = vanilla.CheckBox((inset, linePos, -inset, 20),
                                                "Keep paths in background",
                                                value=True,
                                                sizeStyle='small',
                                                callback=self.SavePreferences)

        linePos += lineGap
        self.w.balanceOverCompletePath = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"Balance components over complete path",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')

        self.w.runButton = vanilla.Button(
            (-80 - inset, -20 - inset, -inset, -inset),
            "Stitch",
            sizeStyle='regular',
            callback=self.ComponentOnLinesMain)
        self.w.setDefaultButton(self.w.runButton)

        try:
            self.LoadPreferences()
        except:
            pass

        self.w.open()
        self.w.makeKey()
Exemplo n.º 18
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 350
        windowHeight = 90
        windowWidthResize = 700  # 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
            "OTVar Player",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.OTVarGlyphAnimator.mainwindow"  # stores last window position and size
        )

        # UI elements:
        self.w.slider = vanilla.Slider((15, 12, -15, 15),
                                       tickMarkCount=None,
                                       callback=self.redrawPreview,
                                       continuous=True,
                                       sizeStyle="regular",
                                       minValue=0,
                                       maxValue=100)
        self.w.slower = vanilla.Button((15, -20 - 15, 47, -15),
                                       u"🚶",
                                       sizeStyle='regular',
                                       callback=self.slower)
        self.w.slower.getNSButton().setToolTip_("Slower")
        self.w.faster = vanilla.Button((65, -20 - 15, 47, -15),
                                       u"🏃",
                                       sizeStyle='regular',
                                       callback=self.faster)
        self.w.faster.getNSButton().setToolTip_("Faster")
        self.w.backAndForth = vanilla.CheckBox((125, -20 - 15, 50, -15),
                                               u"⇋",
                                               value=False,
                                               callback=self.SavePreferences,
                                               sizeStyle='small')

        # web button:
        self.w.buildWeb = vanilla.Button((-140, -35, -100, -15),
                                         u"🌍",
                                         sizeStyle='regular',
                                         callback=self.buildWeb)

        # Run Button:
        self.w.runButton = vanilla.Button((-95, -35, -15, -15),
                                          "Play",
                                          sizeStyle='regular',
                                          callback=self.togglePlay)
        self.w.runButton.getNSButton().setToolTip_("Toggle Play/Pause")
        self.w.setDefaultButton(self.w.runButton)

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

        self.direction = 1
        self.font = Glyphs.font
        self.originalWeightValue = None
        self.isPlaying = False
        if self.font.instances:
            try:
                # GLYPHS 3
                self.originalWeightValue = self.font.instances[0].axes[0]
            except:
                # GLYPHS 2
                self.originalWeightValue = self.font.instances[0].weightValue

        self.w.bind("close", self.restoreFont)

        # open and initialize the preview area at the bottom
        self.redrawPreview(None)

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Exemplo n.º 19
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 610
        windowHeight = 240
        windowWidthResize = 0  # 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 Kerning",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.RemoveKerning.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"Removes group and singleton kerning between the following glyphs:",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

        self.w.leftCategoryText = vanilla.TextBox(
            (inset, linePos + 2, 100, 14),
            u"L Category:",
            sizeStyle='small',
            selectable=True)
        self.w.leftCategory = vanilla.PopUpButton(
            (inset + 100, linePos, 180, 17), (),
            sizeStyle='small',
            callback=self.buttonEnable)
        self.w.rightCategoryText = vanilla.TextBox(
            (300 + inset, linePos + 2, 100, 14),
            u"R Category:",
            sizeStyle='small',
            selectable=True)
        self.w.rightCategory = vanilla.PopUpButton(
            (300 + inset + 100, linePos, 180, 17), (),
            sizeStyle='small',
            callback=self.buttonEnable)
        linePos += lineHeight

        self.w.leftSubCategoryText = vanilla.TextBox(
            (inset, linePos + 2, 100, 14),
            u"L Subcategory:",
            sizeStyle='small',
            selectable=True)
        self.w.leftSubCategory = vanilla.PopUpButton(
            (inset + 100, linePos, 180, 17), (),
            sizeStyle='small',
            callback=self.buttonEnable)
        self.w.rightSubCategoryText = vanilla.TextBox(
            (300 + inset, linePos + 2, 100, 14),
            u"R Subcategory:",
            sizeStyle='small',
            selectable=True)
        self.w.rightSubCategory = vanilla.PopUpButton(
            (300 + inset + 100, linePos, 180, 17), (),
            sizeStyle='small',
            callback=self.buttonEnable)
        linePos += lineHeight

        self.w.leftScriptText = vanilla.TextBox((inset, linePos + 2, 100, 14),
                                                u"L Script:",
                                                sizeStyle='small',
                                                selectable=True)
        self.w.leftScript = vanilla.PopUpButton(
            (inset + 100, linePos, 180, 17), (),
            sizeStyle='small',
            callback=self.buttonEnable)
        self.w.rightScriptText = vanilla.TextBox(
            (300 + inset, linePos + 2, 100, 14),
            u"R Script:",
            sizeStyle='small',
            selectable=True)
        self.w.rightScript = vanilla.PopUpButton(
            (300 + inset + 100, linePos, 180, 17), (),
            sizeStyle='small',
            callback=self.buttonEnable)
        linePos += lineHeight

        self.ReloadCategories()

        self.w.includeDirtyCategories = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Delete group kerning even if groups are ‘dirty’ (e.g., group with uppercase and lowercase letters mixed)",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.reportInMacroWindow = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Detailed report in macro window",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.processAllMasters = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Process all masters (otherwise current master only)",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

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

        self.w.statusText = vanilla.TextBox(
            (inset, -20 - inset, -220 - inset, 14),
            u"",
            sizeStyle='small',
            selectable=True)

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

        # Reload Button:
        self.w.reloadButton = vanilla.Button(
            (-220 - inset, -20 - inset, -130 - inset, -inset),
            "Reload",
            sizeStyle='regular',
            callback=self.ReloadCategories)

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

        self.buttonEnable()

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Exemplo n.º 20
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, 110

        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()
Exemplo n.º 21
0
    def __init__(self):
        # Window 'self.w':
        edY = 22
        txY = 17
        sp = 10
        btnX = 120
        btnY = 20
        windowWidth = 430
        windowHeight = sp * 8 + edY * 3 + txY * 2 + btnY + 20
        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
            "Permutation Text Generator",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.Tosche.PermutationTextGenerator.mainwindow"  # stores last window position and size
        )

        # UI elements:
        self.w.text_A = vanilla.TextBox((sp, sp + 2, 70, txY),
                                        "List A",
                                        sizeStyle='regular')
        self.w.edit_A = vanilla.EditText((sp * 2 + 70, sp, -15, edY),
                                         "",
                                         sizeStyle='small')
        self.w.text_C = vanilla.TextBox((sp, sp * 2 + edY + 2, 70, txY),
                                        "between c",
                                        sizeStyle='regular')
        self.w.edit_C = vanilla.EditText((sp * 2 + 70, sp * 2 + edY, -15, edY),
                                         "",
                                         sizeStyle='small')
        self.w.text_B = vanilla.TextBox((sp, sp * 3 + edY * 2 + 2, 70, txY),
                                        "List B",
                                        sizeStyle='regular')
        self.w.edit_B = vanilla.EditText(
            (sp * 2 + 70, sp * 3 + edY * 2, -15, edY), "", sizeStyle='small')
        self.w.text_3 = vanilla.TextBox((sp, sp * 4 + edY * 3, 85, txY),
                                        "Pattern:",
                                        sizeStyle='regular')
        self.w.radio = vanilla.RadioGroup(
            (sp * 2 + 70, sp * 4 + edY * 3, 320, txY),
            ["BABABAB", "AcB AcB AcB", "BcA BcA BcA"],
            isVertical=False,
            sizeStyle='regular',
            callback=self.dupeControl)
        self.w.edit_3 = vanilla.EditText(
            (sp * 2 + 70, sp * 5 + edY * 3 + txY - 2, 40, edY),
            "0",
            sizeStyle='regular')
        self.w.text_4 = vanilla.TextBox(
            (sp * 2 + 115, sp * 5 + edY * 3 + txY, 200, txY),
            "pairs per line",
            sizeStyle='regular')
        self.w.dupe = vanilla.CheckBox(
            (sp * 3 + 210, sp * 5 + edY * 3 + txY, 200, txY),
            "Remove Duplicates",
            sizeStyle='regular',
            value=False)

        # Run Button:
        self.w.outputButton = vanilla.Button(
            (sp * 2 + 70, -sp * 2 - btnY, btnX, btnY),
            "Macro Panel",
            sizeStyle='regular',
            callback=self.Main)
        self.w.viewButton = vanilla.Button(
            (sp * 3 + 70 + btnX, -sp * 2 - btnY, btnX, btnY),
            "Edit View",
            sizeStyle='regular',
            callback=self.Main)
        self.w.setDefaultButton(self.w.viewButton)

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

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
        self.dupeControl(self.w.radio)
    def __init__(self):
        # Window 'self.w':
        windowWidth = 355
        windowHeight = 345
        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.ignoreDiagonals = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            u"Ignore diagonal stems",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.ignoreDiagonals.getNSButton().setToolTip_(
            "If activated, only measures completely horizontal and completely vertical segments."
        )
        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.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, -inset, 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."
        )
        linePos += lineHeight

        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(
            (-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()
Exemplo n.º 23
0
	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()
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 330
		windowHeight = 410
		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.respectMarkToBaseOffset = vanilla.CheckBox( (inset, linePos, -inset, 20), "Include mark-to-base offset for OS/2 usWin", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.respectMarkToBaseOffset.getNSButton().setToolTip_("If checked will calculate the maximum possible height that can be reached with top-anchored marks, and the lowest depth with bottom-anchored marks, and use those values for the OS/2 usWin values. Strongly recommended for making fonts work on Windows if they rely on mark-to-base positioning (e.g. Arabic). Respects the ‘Limit to Script’ setting.")
		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, but respected for mark-to-base calculation.)")
		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. Does not apply to OS/2 usWin")
		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
		
		self.w.allOpenFonts = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"⚠️ Read out and apply to ALL open fonts", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.allOpenFonts.getNSButton().setToolTip_(u"If activated, does not only measure the frontmost font, but all open fonts. Careful: when you press the Apply button, will also apply it to all open fonts. Useful if you have all font files for a font family open.")
		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()
Exemplo n.º 25
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 350
		windowHeight = 300
		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
			"Kink Finder", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.KinkFinder.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		linePos, inset, lineHeight = 12, 15, 22
		self.w.descriptionText = vanilla.TextBox( (inset, linePos+2, -inset, 30), "Find glyphs where kinks between triplets appear in interpolation, and the kink exceeds the given threshold size.", sizeStyle='small', selectable=True )
		linePos += lineHeight*2
		
		self.w.text_1 = vanilla.TextBox( (inset, linePos+2, 145, 14), "Acceptable max kink size:", sizeStyle='small' )
		self.w.maxKinkSize = vanilla.EditText( (inset+145, linePos-1, -inset, 19), "3", sizeStyle='small', callback=self.SavePreferences)
		self.w.maxKinkSize.getNSTextField().setToolTip_("Measured in units as the perpendicular distance between middle point and the line between first and third points.")
		linePos += lineHeight
		
		self.w.findKinksInMasters = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Find kinks in masters instead (i.e., not in interpolations)", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.findKinksInMasters.getNSButton().setToolTip_("If checked, will not calculte interpolations, but only measure green (smooth) nodes in master, bracket and brace layers.")
		linePos += lineHeight
		
		self.w.betweenAdjacentMastersOnly = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Find kinks between adjacent masters only (single axis, 3+ masters)", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.betweenAdjacentMastersOnly.getNSButton().setToolTip_("If checked, will look for kinks between masters 0+1, 1+2, 1+3, but NOT between 0+2, 1+3 or 0+3. Makes sense if you have only one axis (e.g. weight) and more than two masters in interpolation order (lightest through boldest).")
		linePos += lineHeight
		
		self.w.allGlyphs = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Process all glyphs in font (i.e., ignore selection)", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.allGlyphs.getNSButton().setToolTip_("If unchecked, will only process the current glyph(s).")
		linePos += lineHeight
		
		self.w.exportingOnly = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Ignore non-exporting glyphs", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.exportingOnly.getNSButton().setToolTip_("If checked, will skip glyphs that do not export. Always skips compounds.")
		linePos += lineHeight

		self.w.reportIncompatibilities = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Report incompatibilities in Macro Window", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.reportIncompatibilities.getNSButton().setToolTip_("If checked, will warn about incompatibilities. Usually you want this off, especially when you have bracket layers.")
		linePos += lineHeight

		self.w.markKinks = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Mark kinky nodes in first layer", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.markKinks.getNSButton().setToolTip_("If checked, will mark affected nodes with a warning emoji and the maximum kink distance. Will mark the corresponding node in the first layer if it finds a kink in an instance. Will use an annotation if the node cannot be found (e.g. if the kink happens in a corner component).")
		linePos += lineHeight

		self.w.bringMacroWindowToFront = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Bring Macro Window to front", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.bringMacroWindowToFront.getNSButton().setToolTip_("A detailed report is written to the Macro Window. Activate this check box, and the Macro Window will be brought to the front ever time you run this script.")
		linePos += lineHeight
		
		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( (-120-inset, -20-inset, -inset, -inset), "Open Tab", sizeStyle='regular', callback=self.KinkFinderMain )
		self.w.setDefaultButton( self.w.runButton )
		
		# Load Settings:
		if not self.LoadPreferences():
			print(u"⚠️ Warning: 'Kink Finder' could not load preferences. Will resort to defaults")
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
Exemplo n.º 26
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 350
        windowHeight = 190
        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
            "Bracket Metrics Manager",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.BracketMetricsManager.mainwindow"  # stores last window position and size
        )

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

        self.w.descriptionText = vanilla.TextBox(
            (inset, linePos + 2, -inset, 30),
            u"In selected glyphs, syncs metrics of bracket layers with their associated layer, e.g. ‘Bold [90]’ with ‘Bold’.",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight * 2

        self.w.syncLSB = vanilla.CheckBox((inset, linePos - 1, 85, 20),
                                          "Sync LSB",
                                          value=False,
                                          callback=self.SavePreferences,
                                          sizeStyle='small')
        self.w.syncRSB = vanilla.CheckBox((inset + 85, linePos - 1, 85, 20),
                                          "Sync RSB",
                                          value=False,
                                          callback=self.SavePreferences,
                                          sizeStyle='small')
        self.w.syncWidth = vanilla.CheckBox(
            (inset + 85 * 2, linePos - 1, -inset, 20),
            "Sync Width",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.applyToAllGlyphsWithBrackets = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            "Apply to all glyphs in font that have bracket layers",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.reportOnly = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            "Only report, do not change metrics",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.openTab = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            "Open tab with affected bracket glyphs",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

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

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

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Exemplo n.º 27
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 410
        windowHeight = 195
        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
            "Compound Variabler",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.CompoundVariabler.mainwindow"  # stores last window position and size
        )

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

        self.w.descriptionText = vanilla.TextBox(
            (inset, linePos + 2, -inset, 28),
            u"Reduplicates Brace and Bracket layers of components in the compounds in which they are used. Makes brace and bracket layers work in the compounds.",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight * 2

        self.w.allGlyphs = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Include all exporting glyphs in font (otherwise only selected glyphs)",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.allGlyphs.getNSButton().setToolTip_(
            "If checked, all glyphs in the font will be processed and receive the special (brace and bracket) layers of their respective components. If unchecked, only selected compound glyphs get processed."
        )
        linePos += lineHeight

        self.w.deleteExistingSpecialLayers = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Delete pre-existing special layers in compounds",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.deleteExistingSpecialLayers.getNSButton().setToolTip_(
            "If checked, will delete all brace and bracket layers found in processed compound glyphs."
        )
        linePos += lineHeight

        self.w.openTab = vanilla.CheckBox((inset, linePos - 1, -inset, 20),
                                          u"Open tab with affected compounds",
                                          value=True,
                                          callback=self.SavePreferences,
                                          sizeStyle='small')
        self.w.openTab.getNSButton().setToolTip_(
            "If checked, will open a tab with all compounds that have received new special layers."
        )
        linePos += lineHeight

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

        self.w.processedGlyph = vanilla.TextBox(
            (inset, linePos + 2, -80 - inset, 14),
            u"",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

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

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

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Exemplo n.º 28
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()
        self.w.makeKey()
    def __init__(self):
        self.w = vanilla.FloatingWindow((320, 95), "Rotate around anchor")

        self.w.anchor_text = vanilla.TextBox((15, 15, 120, 15),
                                             "Set 'rotate' anchor to:",
                                             sizeStyle='small')
        self.w.anchor_x = vanilla.EditText((15 + 125, 15 - 3, 40, 15 + 3),
                                           "0",
                                           sizeStyle='small')
        self.w.anchor_y = vanilla.EditText((15 + 125 + 45, 15 - 3, 40, 15 + 3),
                                           "0",
                                           sizeStyle='small')
        self.w.anchor_button = vanilla.Button((-80, 15, -15, 15 - 3),
                                              "Set",
                                              sizeStyle='small',
                                              callback=self.setRotateAnchor)

        self.w.rotate_text1 = vanilla.TextBox((15, 40, 55, 15),
                                              "Rotate by",
                                              sizeStyle='small')
        self.w.rotate_degrees = vanilla.EditText((15 + 60, 40 - 3, 35, 15 + 3),
                                                 "10",
                                                 sizeStyle='small',
                                                 callback=self.SavePreferences)
        self.w.rotate_text2 = vanilla.TextBox((15 + 60 + 40, 40, 50, 15),
                                              "degrees:",
                                              sizeStyle='small')
        self.w.rotate_ccw = vanilla.Button((-150, 40, -85, 15 - 3),
                                           u"↺ ccw",
                                           sizeStyle='small',
                                           callback=self.rotate)
        self.w.rotate_cw = vanilla.Button((-80, 40, -15, 15 - 3),
                                          u"↻ cw",
                                          sizeStyle='small',
                                          callback=self.rotate)

        self.w.stepAndRepeat_text1 = vanilla.TextBox((15, 65, 55, 15),
                                                     "Repeat",
                                                     sizeStyle='small')
        self.w.stepAndRepeat_times = vanilla.EditText(
            (15 + 60, 65 - 3, 35, 15 + 3),
            "5",
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.stepAndRepeat_text2 = vanilla.TextBox(
            (15 + 60 + 40, 65, 50, 15), "times:", sizeStyle='small')
        self.w.stepAndRepeat_ccw = vanilla.Button((-150, 65, -85, 15 - 3),
                                                  u"↺+ ccw",
                                                  sizeStyle='small',
                                                  callback=self.rotate)
        self.w.stepAndRepeat_cw = vanilla.Button((-80, 65, -15, 15 - 3),
                                                 u"↻+ cw",
                                                 sizeStyle='small',
                                                 callback=self.rotate)

        if not self.LoadPreferences():
            self.logToConsole(
                "Rotate: Could not load prefs, will resort to defaults.")
        self.setDefaultRotateAnchor()
        self.w.open()
        self.w.makeKey()
    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()