Ejemplo n.º 1
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 320
		windowHeight = 170
		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 PS Hints", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.RemovePSHints.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		linePos, inset, lineHeight = 12, 15, 22

		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.horizontalStemHints = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Horizontal Stem Hints", value=True, callback=self.SavePreferences, sizeStyle='small' )
		linePos += lineHeight
		
		self.w.verticalStemHints = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Vertical Stem Hints", value=True, callback=self.SavePreferences, sizeStyle='small' )
		linePos += lineHeight
		
		self.w.ghostHints = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Ghost Hints", 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
		
		# Run Button:
		self.w.runButton = vanilla.Button( (-130-inset, -20-inset, -inset, -inset), "Remove Hints", sizeStyle='regular', callback=self.RemovePSHintsMain )
		self.w.setDefaultButton( self.w.runButton )
		
		# Load Settings:
		if not self.LoadPreferences():
			print("Note: 'Remove PS Hints' could not load preferences. Will resort to defaults")
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
Ejemplo n.º 2
0
 def __init__(self, text="", tickCount=None, parentWindow=None):
     if parentWindow is None:
         self.w = vanilla.Window((250, 60),
                                 closable=False,
                                 miniaturizable=False,
                                 textured=False)
     else:
         self.w = vanilla.Sheet((250, 60), parentWindow)
     if tickCount is None:
         isIndeterminate = True
         tickCount = 0
     else:
         isIndeterminate = False
     self.w.progress = vanilla.ProgressBar((15, 15, -15, 12),
                                           maxValue=tickCount,
                                           isIndeterminate=isIndeterminate,
                                           sizeStyle="small")
     self.w.text = vanilla.TextBox((15, 32, -15, 14),
                                   text,
                                   sizeStyle="small")
     self.w.progress.start()
     self.w.center()
     self.setUpBaseWindowBehavior()
     self.w.open()
Ejemplo n.º 3
0
    def __init__(self):

        self.w = vanilla.Window(
            (self.windowWidth, self.windowHeight),
            "Export OTF and TTF into Subfolder",
            minSize=(self.windowWidth, self.windowHeight),
            maxSize=(self.windowWidth, self.windowHeight),
            autosaveName="com.harbortype.exportOtfTtf.mainwindow")

        fontName = NSAttributedString.alloc().initWithString_attributes_(
            "File: " + os.path.basename(Glyphs.font.filepath), self.attributes)
        self.w.currentFont = vanilla.TextBox(
            (self.margin, self.margin - 10, -self.margin, self.line),
            fontName,
            alignment="right")
        self.currentLine += self.line

        self.w.subfolder_title = vanilla.TextBox(
            (self.margin, self.margin + self.currentLine, 80, self.line),
            "Subfolder: ")
        self.w.subfolder = vanilla.EditText(
            (self.margin + 80, self.margin + self.currentLine - 3,
             -self.margin, self.line), )
        self.currentLine += self.line + 13

        self.w.allOpenFonts = vanilla.CheckBox(
            (self.margin, self.margin + self.currentLine, self.column,
             self.line),
            "All open fonts",
            callback=self.savePreferences)

        self.currentLine += self.line + 13

        self.w.line = vanilla.VerticalLine(
            (self.windowWidth / 2, self.margin + self.currentLine, 1,
             self.line * 3))

        self.w.otf = vanilla.CheckBox(
            (self.margin, self.margin + self.currentLine, self.column,
             self.line),
            "Export OTF",
            callback=self.savePreferences)
        self.currentLine += self.line
        self.w.otfRemoveOverlaps = vanilla.CheckBox(
            (self.margin * 2, self.margin + self.currentLine, self.column,
             self.line),
            "Remove overlaps",
            callback=self.savePreferences)
        self.currentLine += self.line
        self.w.otfAutohint = vanilla.CheckBox(
            (self.margin * 2, self.margin + self.currentLine, self.column,
             self.line),
            "Autohint",
            callback=self.savePreferences)
        self.currentLine -= self.line * 2

        self.w.ttf = vanilla.CheckBox(
            (self.margin * 3 + self.column, self.margin + self.currentLine,
             self.column, self.line),
            "Export TTF",
            callback=self.savePreferences)
        self.currentLine += self.line
        self.w.ttfRemoveOverlaps = vanilla.CheckBox(
            (self.margin * 4 + self.column, self.margin + self.currentLine,
             self.column, self.line),
            "Remove overlaps",
            callback=self.savePreferences)
        self.currentLine += self.line
        self.w.ttfAutohint = vanilla.CheckBox(
            (self.margin * 4 + self.column, self.margin + self.currentLine,
             self.column, self.line),
            "Autohint",
            callback=self.savePreferences)
        self.currentLine += self.line * 1.5

        self.w.progress = vanilla.ProgressBar(
            (self.margin, self.margin + self.currentLine,
             self.windowWidth - self.margin * 2, 16), )
        self.w.progress.set(0)  # set progress indicator to zero

        self.w.closeButton = vanilla.Button(
            (self.margin, -self.margin - self.line,
             self.windowWidth - self.margin * 2, self.line),
            "Cancel",
            callback=self.closeWindow)
        self.w.runButton = vanilla.Button(
            (self.margin, -self.margin - self.line * 2 - 8,
             self.windowWidth - self.margin * 2, self.line),
            "Export fonts",
            callback=self.export)

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

        self.w.setDefaultButton(self.w.runButton)
        try:
            # Python 3
            self.w.closeButton.bind(chr(27), [])
        except:
            # Python 2
            self.w.closeButton.bind(unichr(27), [])
        self.w.open()
        self.w.makeKey()
Ejemplo n.º 4
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 410
		windowHeight = 310
		windowWidthResize  = 800 # 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
			"KernCrasher", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.KernCrasher.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"Open tab with kern collisions in current master:", sizeStyle='small', selectable=True )
		linePos += lineHeight
		
		self.w.textScript = vanilla.TextBox( (inset, linePos+2, 42, 14), u"Script:", sizeStyle='small', selectable=True )
		self.w.popupScript = vanilla.ComboBox( (inset+42, linePos-1, 110, 18), ("latin","cyrillic","greek"), callback=self.SavePreferences, sizeStyle='small' )
		self.w.textDistance = vanilla.TextBox( (inset+160, linePos+2, 100, 14), "Min distance:", sizeStyle='small' )
		self.w.minDistance = vanilla.EditText( (inset+240, linePos-1, -15, 19), "10", sizeStyle='small')
		linePos += lineHeight

		self.w.textSpeed = vanilla.TextBox( (inset, linePos+2, 42, 14), u"Speed:", sizeStyle='small', selectable=True )
		self.w.popupSpeed = vanilla.PopUpButton( (inset+42, linePos, 110, 17), ("very slow","slow","medium","fast","very fast"), callback=self.SavePreferences, sizeStyle='small' )
		intervalIndex = Glyphs.defaults["com.mekkablue.KernCrasher.popupSpeed"]
		if intervalIndex is None:
			intervalIndex = 0
		self.w.text_speedExplanation = vanilla.TextBox( (inset+160, linePos+2, -inset, 14), "Measuring every %i units."%intervalList[intervalIndex], sizeStyle='small' )
		linePos += lineHeight
		
		self.w.text_3 = vanilla.TextBox( (inset, linePos+2, 90, 14), "Left Category:", sizeStyle='small' )
		self.w.popupLeftCat = vanilla.PopUpButton( (inset+90, linePos, -inset, 17), categoryList, callback=self.SavePreferences, sizeStyle='small' )
		linePos += lineHeight

		self.w.text_4 = vanilla.TextBox( (inset, linePos+2, 90, 14), "Right Category:", sizeStyle='small' )
		self.w.popupRightCat = vanilla.PopUpButton( (inset+90, linePos, -inset, 17), categoryList, callback=self.SavePreferences, sizeStyle='small' )
		linePos += lineHeight
		
		self.w.text_5 = vanilla.TextBox( (inset, linePos+2, 160, 14), "Exclude glyphs containing:", sizeStyle='small' )
		self.w.excludeSuffixes = vanilla.EditText( (inset+150, linePos, -inset, 19), ".locl, .alt, .sups, .sinf, .tf, .tosf, Ldot, ldot, Jacute, jacute", callback=self.SavePreferences, sizeStyle='small')
		linePos += lineHeight

		self.w.text_6 = vanilla.TextBox( (inset, linePos+2, 160, 14), "Ignore height intervals:", sizeStyle='small' )
		self.w.ignoreIntervals = vanilla.EditText( (inset+150, linePos, -inset, 19), "", callback=self.SavePreferences, sizeStyle='small')
		self.w.ignoreIntervals.getNSTextField().setPlaceholderString_("200:300, 400:370, -200:-150")
		linePos += lineHeight
		
		self.w.pathGlyphsOnly = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Limit to glyphs containing paths (i.e., exclude compounds)", value=False, callback=self.SavePreferences, sizeStyle='small' )
		linePos += lineHeight

		self.w.excludeNonExporting = vanilla.CheckBox( (inset, linePos, -inset, 20), "Exclude non-exporting glyphs", value=True, sizeStyle='small', callback=self.SavePreferences )
		linePos += lineHeight

		self.w.reportCrashesInMacroWindow = vanilla.CheckBox( (inset, linePos, -inset, 20), "Also report in Macro Window (slower)", value=False, sizeStyle='small', callback=self.SavePreferences )
		self.w.reuseCurrentTab = vanilla.CheckBox( (inset+240, linePos, -inset, 20), u"Reuse current tab", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.reuseCurrentTab.getNSButton().setToolTip_(u"If enabled, will not open a new tab with newly added kern pairs, but reuse the current Edit tab. Will open an Edit tab if none is open.")
		linePos += lineHeight
		
		
		# Percentage:
		self.w.bar = vanilla.ProgressBar((inset, linePos, -inset, 16))
		
		#self.w.percentage = vanilla.TextBox( (15-1, -30, -100-15, -15), "", sizeStyle='small' )
		
		# Buttons:
		self.w.nextButton = vanilla.Button( (-inset-210, -20-inset, -inset-100, -inset), u"Next Master", sizeStyle='regular', callback=self.masterSwitch )
		
		# Run Button:
		self.w.runButton = vanilla.Button((-90-inset, -20-inset, -inset, -inset), "Open Tab", sizeStyle='regular', callback=self.KernCrasherMain )
		self.w.setDefaultButton( self.w.runButton )
		
		# Load Settings:
		if not self.LoadPreferences():
			print("Note: 'KernCrasher' could not load preferences. Will resort to defaults")
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
Ejemplo n.º 5
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 350
        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
            u"🔥 Rewire Fire 🔥",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.RewireFire.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"Finds candidates for rewiring with Reconnect Nodes.",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

        self.w.includeNonExporting = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Include non-exporting glyphs",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.includeNonExporting.getNSButton().setToolTip_(
            "Also check in glyphs that are not set to export. Recommended if you have modular components in the font."
        )
        linePos += lineHeight

        self.w.markWithCircle = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Circle duplicate coordinates with annotation ⭕️",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.markWithCircle.getNSButton().setToolTip_(
            "Circle annotations remain after reconnecting the nodes.")
        linePos += lineHeight

        self.w.setFireToNode = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Mark nodes with fire emoji 🔥",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.setFireToNode.getNSButton().setToolTip_(
            "Emoji will be added as a node name. Node names may disappear after reconnection and path cleanup."
        )
        linePos += lineHeight

        self.w.openTabWithAffectedLayers = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"New tab with affected layers (otherwise report only)",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.openTabWithAffectedLayers.getNSButton().setToolTip_(
            "If checked, will open a new tab with all layers that contain duplicate coordinates. Otherwise, will report in Macro Window only."
        )
        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, -80 - inset, -inset),
            u"🤖 Ready.",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

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

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

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Ejemplo n.º 6
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 350
		windowHeight = 280
		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
			"Short Segment Finder", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.ShortSegmentFinder.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"Finds short segments in interpolations or masters, and opens a new tab with them", sizeStyle='small', selectable=True )
		linePos += lineHeight*2
		
		self.w.text_1 = vanilla.TextBox( (inset, linePos+2, 185, 14), "Acceptable min segment length:", sizeStyle='small' )
		self.w.minSegmentLength = vanilla.EditText( (inset+185, linePos-1, -inset, 19), "3", sizeStyle='small', callback=self.SavePreferences)
		self.w.minSegmentLength.getNSTextField().setToolTip_("Minimum length for every segment in all paths, measured in units.")
		linePos += lineHeight
		
		self.w.findShortSegmentsInMasters = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Look in masters instead (i.e., not in interpolations)", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.findShortSegmentsInMasters.getNSButton().setToolTip_("If checked, will not calculate interpolations, but only measure segments in your master drawings, bracket and brace layers.")
		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 currently selected 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 and no paths in Macro Window", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.reportIncompatibilities.getNSButton().setToolTip_("If checked, will warn about incompatibilities and if a glyph has no paths. Usually you want this off, because it will report all compounds.")
		linePos += lineHeight

		self.w.markSegments = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Mark segments in first layer", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.markSegments.getNSButton().setToolTip_("If checked, will mark affected segments with a warning emoji and the minimum segment length. Will mark the corresponding segment in the first layer if it finds a short segment in a calculated instance. Will use an annotation if the segment cannot be found (e.g. if the segment is 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.ShortSegmentFinderMain )
		self.w.setDefaultButton( self.w.runButton )
		
		# Load Settings:
		if not self.LoadPreferences():
			print "Note: 'Short Segment Finder' could not load preferences. Will resort to defaults"
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
		
		#
		self.adaptUItext(None)
    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()
Ejemplo n.º 8
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 320
        windowHeight = 190
        windowWidthResize = 50  # 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
            "Zero Kerner",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.ZeroKerner.mainwindow"  # stores last window position and size
        )

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

        self.w.descriptionText = vanilla.TextBox(
            (inset, linePos + 2, -inset, 44),
            u"Add group kernings with value zero for pairs that are missing in one master but present in others. Helps preserve interpolatable kerning in OTVar exports.",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight * 2.5

        self.w.limitToCurrentMaster = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Limit to current master only (otherwise, all masters)",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.limitToCurrentMaster.getNSButton().setToolTip_(
            "Will apply zero kernings only to the currently selected master. Uncheck if all masters should be zero-kerned."
        )
        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')
        self.w.reportInMacroWindow.getNSButton().setToolTip_(
            "If checked, will write a progress report in the Macro Window (Cmd-Opt-M)."
        )
        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),
            "Zero Kern",
            sizeStyle='regular',
            callback=self.ZeroKernerMain)
        self.w.setDefaultButton(self.w.runButton)

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

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Ejemplo n.º 9
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 390
        windowHeight = 260
        windowWidthResize = 800  # 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
            "GapFinder",  # window title
            minSize=(windowWidth, windowHeight),  # Maximum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.GapFinder.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"Open tab with kern gaps in current master:",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

        self.w.textScript = vanilla.TextBox((inset, linePos + 2, 42, 14),
                                            u"Script:",
                                            sizeStyle='small',
                                            selectable=True)
        self.w.popupScript = vanilla.ComboBox(
            (inset + 42, linePos - 1, 110, 18), ("latin", "cyrillic", "greek"),
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.textDistance = vanilla.TextBox(
            (inset + 160, linePos + 2, 100, 14),
            "Max distance:",
            sizeStyle='small')
        self.w.maxDistance = vanilla.EditText(
            (inset + 240, linePos - 1, -15, 19), "200", sizeStyle='small')
        linePos += lineHeight

        self.w.textSpeed = vanilla.TextBox((inset, linePos + 2, 42, 14),
                                           u"Speed:",
                                           sizeStyle='small',
                                           selectable=True)
        self.w.popupSpeed = vanilla.PopUpButton(
            (inset + 42, linePos, 110, 17),
            ("very slow", "slow", "medium", "fast", "very fast"),
            callback=self.SavePreferences,
            sizeStyle='small')
        intervalIndex = Glyphs.defaults["com.mekkablue.GapFinder.popupSpeed"]
        if intervalIndex is None:
            intervalIndex = 0
        self.w.text_speedExplanation = vanilla.TextBox(
            (inset + 160, linePos + 2, -inset, 14),
            "Measuring every %i units." % intervalList[intervalIndex],
            sizeStyle='small')
        linePos += lineHeight

        self.w.text_3 = vanilla.TextBox((inset, linePos + 2, 90, 14),
                                        "Left Category:",
                                        sizeStyle='small')
        self.w.popupLeftCat = vanilla.PopUpButton(
            (inset + 90, linePos, -inset, 17),
            categoryList,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.text_4 = vanilla.TextBox((inset, linePos + 2, 90, 14),
                                        "Right Category:",
                                        sizeStyle='small')
        self.w.popupRightCat = vanilla.PopUpButton(
            (inset + 90, linePos, -inset, 17),
            categoryList,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.text_5 = vanilla.TextBox((inset, linePos + 2, 160, 14),
                                        "Exclude glyphs containing:",
                                        sizeStyle='small')
        self.w.excludeSuffixes = vanilla.EditText(
            (inset + 150, linePos, -inset, 19),
            ".locl, .alt, .sups, .sinf, .tf, .tosf, Ldot, ldot, Jacute, jacute",
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.excludeNonExporting = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            "Exclude non-exporting glyphs",
            value=True,
            sizeStyle='small',
            callback=self.SavePreferences)
        linePos += lineHeight

        self.w.reportGapsInMacroWindow = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            "Also report in Macro Window (a few seconds slower)",
            value=False,
            sizeStyle='small',
            callback=self.SavePreferences)
        linePos += lineHeight

        # Percentage:
        self.w.bar = vanilla.ProgressBar((inset, linePos, -inset, 16))

        #self.w.percentage = vanilla.TextBox( (15-1, -30, -100-15, -15), "", sizeStyle='small' )

        # Run Button:
        self.w.runButton = vanilla.Button((-100 - 15, -20 - 15, -15, -15),
                                          "Open Tab",
                                          sizeStyle='regular',
                                          callback=self.GapFinderMain)
        self.w.setDefaultButton(self.w.runButton)

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

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Ejemplo n.º 10
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()
Ejemplo n.º 11
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()
Ejemplo n.º 12
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 410
        windowHeight = 350
        windowWidthResize = 800  # 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
            "KernCrasher",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.KernCrasher.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"Open tab with kern collisions in current master:",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

        self.w.textScript = vanilla.TextBox((inset, linePos + 2, 42, 14),
                                            u"Script:",
                                            sizeStyle='small',
                                            selectable=True)
        self.w.popupScript = vanilla.ComboBox(
            (inset + 42, linePos - 1, 110, 18), ("latin", "cyrillic", "greek"),
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.popupScript.getNSComboBox().setToolTip_(
            "Limits the kerning pairs only to glyphs of this script, and those of no script."
        )
        self.w.updateScriptsButton = vanilla.SquareButton(
            (inset + 160, linePos, 20, 18),
            "↺",
            sizeStyle='small',
            callback=self.update)
        self.w.updateScriptsButton.getNSButton().setToolTip_(
            "Scans the frontost font for the scripts of all its glyphs (Latin, Greek, Cyrillic, Hebrew, Arabic, Thai, ...) and lists only those in the combo box."
        )
        self.w.textDistance = vanilla.TextBox(
            (inset + 200, linePos + 2, 100, 14),
            "Min distance:",
            sizeStyle='small')
        self.w.minDistance = vanilla.EditText(
            (inset + 280, linePos - 1, -15, 19), "10", sizeStyle='small')
        tooltipText = "Minimum distance required between glyphs in any given pairing with the current setup. Measured in units."
        self.w.textDistance.getNSTextField().setToolTip_(tooltipText)
        self.w.minDistance.getNSTextField().setToolTip_(tooltipText)
        linePos += lineHeight

        self.w.textSpeed = vanilla.TextBox((inset, linePos + 2, 42, 14),
                                           u"Speed:",
                                           sizeStyle='small',
                                           selectable=True)
        self.w.popupSpeed = vanilla.PopUpButton(
            (inset + 42, linePos, 110, 17),
            ("very slow", "slow", "medium", "fast", "very fast"),
            callback=self.SavePreferences,
            sizeStyle='small')
        intervalIndex = Glyphs.defaults["com.mekkablue.KernCrasher.popupSpeed"]
        if intervalIndex is None:
            intervalIndex = 0
        self.w.text_speedExplanation = vanilla.TextBox(
            (inset + 160, linePos + 2, -inset, 14),
            "Measuring every %i units." % intervalList[intervalIndex],
            sizeStyle='small')
        tooltipText = "The distances within every glyph pair will be measured from top to bottom. This setting determines how many measurements are taken. Higher speed means less measurements and thus less accuracy. Many measurements are more accurate, but also slow down the script significantly."
        self.w.textSpeed.getNSTextField().setToolTip_(tooltipText)
        self.w.popupSpeed.getNSPopUpButton().setToolTip_(tooltipText)
        self.w.text_speedExplanation.getNSTextField().setToolTip_(tooltipText)
        linePos += lineHeight

        self.w.text_popupLeftCat = vanilla.TextBox(
            (inset, linePos + 2, 90, 14), "Left Category:", sizeStyle='small')
        self.w.popupLeftCat = vanilla.PopUpButton(
            (inset + 90, linePos, -inset, 17),
            categoryList,
            callback=self.SavePreferences,
            sizeStyle='small')
        tooltipText = "The category for the glyph on the LEFT side of the kerning pair. In ‘AV’, that would be ‘A’."
        self.w.text_popupLeftCat.getNSTextField().setToolTip_(tooltipText)
        self.w.popupLeftCat.getNSPopUpButton().setToolTip_(tooltipText)
        linePos += lineHeight

        self.w.text_popupRightCat = vanilla.TextBox(
            (inset, linePos + 2, 90, 14), "Right Category:", sizeStyle='small')
        self.w.popupRightCat = vanilla.PopUpButton(
            (inset + 90, linePos, -inset, 17),
            categoryList,
            callback=self.SavePreferences,
            sizeStyle='small')
        tooltipText = "The category for the glyph on the RIGHT side of the kerning pair. In ‘AV’, that would be ‘V’."
        self.w.text_popupRightCat.getNSTextField().setToolTip_(tooltipText)
        self.w.popupRightCat.getNSPopUpButton().setToolTip_(tooltipText)
        linePos += lineHeight

        self.w.text_limitLeftSuffixes = vanilla.TextBox(
            (inset, linePos + 2, 160, 14),
            "Left glyph must contain:",
            sizeStyle='small')
        self.w.limitLeftSuffixes = vanilla.EditText(
            (inset + 150, linePos, -inset, 19),
            "",
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.limitLeftSuffixes.getNSTextField().setPlaceholderString_(
            "tilde, macron, dieresis, circumflex, caron")
        tooltipText = "Only glyphs with these parts in their glyph names will be considered for the LEFT side. Comma-separated list. Usually not necessary, but useful for tracking down problems with wide diacritics."
        self.w.text_limitLeftSuffixes.getNSTextField().setToolTip_(tooltipText)
        self.w.limitLeftSuffixes.getNSTextField().setToolTip_(tooltipText)
        linePos += lineHeight

        self.w.text_limitRightSuffixes = vanilla.TextBox(
            (inset, linePos + 2, 160, 14),
            "Right glyph must contain:",
            sizeStyle='small')
        self.w.limitRightSuffixes = vanilla.EditText(
            (inset + 150, linePos, -inset, 19),
            "",
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.limitRightSuffixes.getNSTextField().setPlaceholderString_(
            "tilde, macron, dieresis, circumflex, caron")
        tooltipText = "Only glyphs with these parts in their glyph names will be considered for the RIGHT side. Comma-separated list. Usually not necessary, but useful for tracking down problems with wide diacritics."
        self.w.text_limitRightSuffixes.getNSTextField().setToolTip_(
            tooltipText)
        self.w.limitRightSuffixes.getNSTextField().setToolTip_(tooltipText)
        linePos += lineHeight

        self.w.text_excludeSuffixes = vanilla.TextBox(
            (inset, linePos + 2, 160, 14),
            "Exclude glyphs containing:",
            sizeStyle='small')
        self.w.excludeSuffixes = vanilla.EditText(
            (inset + 150, linePos, -inset, 19),
            ".locl, .alt, .sups, .sinf, .tf, .tosf, Ldot, ldot, Jacute, jacute",
            callback=self.SavePreferences,
            sizeStyle='small')
        tooltipText = "Glyphs with these parts in their glyph names will be ignored. Comma-separated list. Useful for excluding impossible pairings, like ldot (can only appear before l) and jacute (can only appear after iacute), or OpenType variants."
        self.w.text_excludeSuffixes.getNSTextField().setToolTip_(tooltipText)
        self.w.excludeSuffixes.getNSTextField().setToolTip_(tooltipText)
        linePos += lineHeight

        self.w.text_ignoreIntervals = vanilla.TextBox(
            (inset, linePos + 2, 160, 14),
            "Ignore height intervals:",
            sizeStyle='small')
        self.w.ignoreIntervals = vanilla.EditText(
            (inset + 150, linePos, -inset, 19),
            "",
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.ignoreIntervals.getNSTextField().setPlaceholderString_(
            "200:300, 400:370, -200:-150")
        tooltipText = "Will not measure between the specified heights. Useful for excluding connectors of connecting script typefaces or rekha lines like in Devanagari, where an overlap is intended by design. Specify two numbers separated by a colon, e.g., 200:300, and it will only measure until y=200 and start measuring again at y=300, skipping everything in between. If you specify multiple ranges, separate them with commas."
        self.w.text_ignoreIntervals.getNSTextField().setToolTip_(tooltipText)
        self.w.ignoreIntervals.getNSTextField().setToolTip_(tooltipText)
        linePos += lineHeight

        self.w.pathGlyphsOnly = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Limit to glyphs containing paths (i.e., exclude composites)",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.pathGlyphsOnly.getNSButton().setToolTip_(
            "If enabled, will ignore glyphs that do not have paths. Useful for focusing on the base shapes (before you deal with the specific problems of composite diacritics)."
        )
        linePos += lineHeight

        self.w.excludeNonExporting = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            "Exclude non-exporting glyphs",
            value=True,
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.excludeNonExporting.getNSButton().setToolTip_(
            "If enabled, will ignore glyphs that are set to not export. Recommended, otherwise you may get a lot of false positives."
        )
        linePos += lineHeight

        self.w.reportCrashesInMacroWindow = vanilla.CheckBox(
            (inset, linePos, -inset, 20),
            "Verbose report in Macro Window",
            value=False,
            sizeStyle='small',
            callback=self.SavePreferences)
        self.w.reportCrashesInMacroWindow.getNSButton().setToolTip_(
            "Will output a detailed report of the kern crashing in Window > Macro Panel. Will slow down the script a bit. Usually not necessary, but can be useful for checking if a certain pairing has been taken care of or not."
        )
        self.w.reuseCurrentTab = vanilla.CheckBox(
            (inset + 240, linePos, -inset, 20),
            u"Reuse current tab",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.reuseCurrentTab.getNSButton().setToolTip_(
            "If enabled, will not open a new tab with newly added kern pairs, but reuse the current Edit tab. Will open an Edit tab if none is open."
        )
        linePos += lineHeight

        # Percentage:
        self.w.bar = vanilla.ProgressBar((inset, linePos, -inset, 16))

        #self.w.percentage = vanilla.TextBox( (15-1, -30, -100-15, -15), "", sizeStyle='small' )

        # Buttons:
        self.w.nextButton = vanilla.Button(
            (-inset - 210, -20 - inset, -inset - 100, -inset),
            u"Next Master",
            sizeStyle='regular',
            callback=self.masterSwitch)

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

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

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Ejemplo n.º 13
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 290
		windowHeight = 270
		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
			"KernCrasher", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.KernCrasher.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		self.w.text_1 = vanilla.TextBox( (15-1, 12+2, -15, 14), "Open tab with kern collisions in current master:", sizeStyle='small' )

		self.w.text_21 = vanilla.TextBox( (15-1, 32+2, 42, 14), "Script:", sizeStyle='small' )
		self.w.popupScript = vanilla.PopUpButton( (15+42, 32, 80, 17), ["latin","cyrillic","greek"], callback=self.SavePreferences, sizeStyle='small' )
		
		self.w.text_22 = vanilla.TextBox( (140, 32+2, 150, 14), "Min distance:", sizeStyle='small' )
		self.w.minDistance = vanilla.EditText( (220, 32-1, -15, 19), "10", sizeStyle='small')
		
		self.w.text_speed = vanilla.TextBox( (15-1, 52+2, 42, 14), "Speed:", sizeStyle='small' )
		self.w.popupSpeed = vanilla.PopUpButton( (15+42, 52, 80, 17), ["very slow","slow","medium","fast","very fast"], callback=self.SavePreferences, sizeStyle='small' )
		intervalIndex = Glyphs.defaults["com.mekkablue.KernCrasher.popupSpeed"]
		if intervalIndex is None:
			intervalIndex = 0
		self.w.text_speedExplanation = vanilla.TextBox( (140, 52+2, -15, 14), "Measuring every %i units."%intervalList[intervalIndex], sizeStyle='small' )
		
		self.w.text_3 = vanilla.TextBox( (15-1, 20+52+2, 90, 14), "Left Category:", sizeStyle='small' )
		self.w.popupLeftCat = vanilla.PopUpButton( (15+90, 20+52, -15, 17), categoryList, callback=self.SavePreferences, sizeStyle='small' )

		self.w.text_4 = vanilla.TextBox( (15-1, 20+72+2, 90, 14), "Right Category:", sizeStyle='small' )
		self.w.popupRightCat = vanilla.PopUpButton( (15+90, 20+72, -15, 17), categoryList, callback=self.SavePreferences, sizeStyle='small' )
		
		self.w.text_5 = vanilla.TextBox( (15-1, 20+92+2, 160, 14), "Exclude glyphs containing:", sizeStyle='small' )
		self.w.excludeSuffixes = vanilla.EditText( (170, 20+92, -15, 19), ".locl, .alt, .sups, .sinf, .tf, .tosf, Ldot, ldot, Jacute, jacute", callback=self.SavePreferences, sizeStyle='small')

		self.w.text_6 = vanilla.TextBox( (15-1, 20+112+2, 160, 14), "Ignore height intervals:", sizeStyle='small' )
		self.w.ignoreIntervals = vanilla.EditText( (170, 20+112, -15, 19), "", callback=self.SavePreferences, sizeStyle='small')
		self.w.ignoreIntervals.getNSTextField().setPlaceholderString_("200:300, 400:370, -200:-150")

		self.w.excludeNonExporting = vanilla.CheckBox((15-1, 20+132+2, -15, 17), "Exclude non-exporting glyphs", value=True, sizeStyle='small', callback=self.SavePreferences )
		self.w.reportCrashesInMacroWindow = vanilla.CheckBox((15-1, 20+152+2, -15, 17), "Also report in Macro Window (a few seconds slower)", value=False, sizeStyle='small', callback=self.SavePreferences )
		
		# Percentage:
		self.w.bar = vanilla.ProgressBar((15-1, 20+172+2, -15, 16))
		
		#self.w.percentage = vanilla.TextBox( (15-1, -30, -100-15, -15), "", sizeStyle='small' )
		
		# Run Button:
		self.w.runButton = vanilla.Button((-100-15, -20-15, -15, -15), "Open Tab", sizeStyle='regular', callback=self.KernCrasherMain )
		self.w.setDefaultButton( self.w.runButton )
		
		# Load Settings:
		if not self.LoadPreferences():
			print "Note: 'KernCrasher' could not load preferences. Will resort to defaults"
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
Ejemplo n.º 14
0
 def progressBar(self):
     self.p = vanilla.Window((300, 40))
     self.p.bar = vanilla.ProgressBar((10, 10, -10, 16))
     self.p.open()
     self.p.bar.set(0)
     self.wunit = 100.000 / len(self.mySelection)
Ejemplo n.º 15
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 405
		windowHeight = 260
		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
			"Composite 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 Bracket layers of components in the composites in which they are used. Makes bracket layers work in the variable font exports.", 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 composite glyphs get processed.")
		linePos += lineHeight

		self.w.decomposeBrackets = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Decompose bracket layers in composites (currently broken)", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.decomposeBrackets.getNSButton().setToolTip_("If checked, will decompose bracket layers. This is necessary for bracket layers to work in OTVAR fonts in Glyphs 2.6.")
		linePos += lineHeight
		
		self.w.deleteExistingSpecialLayers = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Delete pre-existing bracket layers in composites", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.deleteExistingSpecialLayers.getNSButton().setToolTip_("If checked, will delete all bracket layers found in processed composite glyphs.")
		linePos += lineHeight
		
		self.w.justBackupInstead = vanilla.CheckBox( (inset*2, linePos-1, -inset, 20), u"Don’t delete, just backup and deactivate instead", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.justBackupInstead.getNSButton().setToolTip_("If checked, will not delete, but just deactivate the layer by renaming it from ‘[100]’ to ‘#100#’.")
		linePos += lineHeight
		
		self.w.openTab = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Open tab with affected composites", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.openTab.getNSButton().setToolTip_("If checked, will open a tab with all composites that have received new special layers.")
		linePos += lineHeight
		
		self.w.catchNestedComponents = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Catch all nested components (slower)", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.catchNestedComponents.getNSButton().setToolTip_(u"If checked, will count max component depth (number of nestings, i.e. components of components of components, etc.) in the font, and repeat the whole process as many times. Will take significantly longer. Use this only if you need it (unlikely) and know what you are doing.")
		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: 'Composite Variabler' could not load preferences. Will resort to defaults")
		
		# Open window and focus on it:
		self.w.open()
		self.updateUI()
		self.w.makeKey()
Ejemplo n.º 16
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()
Ejemplo n.º 17
0
    def __init__(self):
        self.Tool = GlyphsPathPlugin.alloc().init()

        # Window 'self.w':
        windowWidth = 300
        windowHeight = 245
        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
            "Green Blue Manager",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.GreenBlueManager.mainwindow"  # stores last window position and size
        )

        # UI elements:
        linePos, inset, lineHeight = 5, 15, 22
        self.w.descriptionText = vanilla.TextBox(
            (inset, linePos + 2, -inset, lineHeight * 2),
            u"Validates the connection state of nodes, green vs. blue, according to the angle between them. Optionally corrects green/blue state and handles.",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight * 2.5

        self.w.thresholdAngleText = vanilla.TextBox((inset, linePos, 110, 14),
                                                    u"Threshold Angle:",
                                                    sizeStyle='small',
                                                    selectable=True)
        self.w.thresholdAngle = vanilla.EditText(
            (inset + 110, linePos - 2, -inset, 19),
            "11",
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.completeFont = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Process complete font (otherwise selection)",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.completeFont.getNSButton().setToolTip_(
            "If checked, will go through all active (i.e., master, brace and bracket) layers of all glyphs. If unchecked, will only go through selected layers. Careful: can take a minute."
        )
        linePos += lineHeight

        self.w.fixGreenBlue = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Fix green vs. blue connection for on-curves",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.fixGreenBlue.getNSButton().setToolTip_(
            "Sets the green/blue state of an on-curve node according to the connection angle. Any connection below the threshold angle will be green, otherwise blue. Deselect both Fix and Realign options for a new tab with all glyphs that have nodes with wrong connections according to the threshold angle."
        )
        linePos += lineHeight

        self.w.realignHandles = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Realign handles attached to green nodes",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.realignHandles.getNSButton().setToolTip_(
            "If a BCP (grey handle) follows a green node, it will be aligned to the previous two points. Deselect both Fix and Realign options for a new tab with all glyphs that have nodes with wrong connections according to the threshold angle."
        )
        linePos += lineHeight

        self.w.reportInMacroWindow = vanilla.CheckBox(
            (inset, linePos - 1, 160, 20),
            u"Report in Macro window",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.reportInMacroWindowVerbose = vanilla.CheckBox(
            (inset + 160, linePos - 1, -inset, 20),
            u"Verbose",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.reportInMacroWindow.getNSButton().setToolTip_(
            "If enabled, will output a report in Window > Macro Panel.")
        self.w.reportInMacroWindowVerbose.getNSButton().setToolTip_(
            "If enabled, will output a verbose (detailed) report in Window > Macro Panel."
        )
        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.processingText = vanilla.TextBox(
            (inset, linePos + 2, -120 - inset, 14),
            u"",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

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

        # Load Settings:
        if not self.LoadPreferences():
            print "Note: 'Set Green Or Blue According To Angle' could not load preferences. Will resort to defaults"

        self.checkGUI()

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Ejemplo n.º 18
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()
Ejemplo n.º 19
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()
Ejemplo n.º 20
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()
Ejemplo n.º 21
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 350
		windowHeight = 240
		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
			u"%s Rewire Fire %s" % (self.duplicateMarker, self.onSegmentMarker) , # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.RewireFire.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"Finds candidates for rewiring with Reconnect Nodes.", sizeStyle='small', selectable=True )
		linePos += lineHeight
		
		self.w.setFireToNode = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Mark duplicate nodes with fire emoji %s"%self.duplicateMarker, value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.setFireToNode.getNSButton().setToolTip_("Finds different on-curve nodes that share the same coordinates. Emoji will be added as a node name. Node names may disappear after reconnection and path cleanup.")
		linePos += lineHeight
		
		self.w.tolerateZeroSegments = vanilla.CheckBox( (inset*2, linePos-1, -inset*2, 20), u"Tolerate duplicate if it is neighboring node (OTVar)", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.tolerateZeroSegments.getNSButton().setToolTip_(u"If node coordinates within the same segment share the same coordinates, they will not be marked with a fire emoji. Makes sense in variable fonts, where segments need to disappear in a point in one master.")
		linePos += lineHeight
		
		
		# DISABLED
		# self.w.markWithCircle = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Circle duplicate coordinates with annotation ⭕️", value=False, callback=self.SavePreferences, sizeStyle='small' )
		# self.w.markWithCircle.getNSButton().setToolTip_("Circle annotations remain after reconnecting the nodes.")
		# linePos += lineHeight

		self.w.dynamiteForOnSegment = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Mark nodes on top of line segments with dynamite emoji %s"%self.onSegmentMarker, value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.dynamiteForOnSegment.getNSButton().setToolTip_("Finds on-curve nodes that are located on line segments between (other) two on-curve nodes. Emoji will be added as a node name. Node names may disappear after reconnection and path cleanup.")
		linePos += lineHeight

		self.w.shouldSelect = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Select nodes for rewiring on affected glyph layers", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.shouldSelect.getNSButton().setToolTip_("If nodes are found, will reset the layer selection and select only the affected nodes. In the best case, you should be able to right-click, hold down the Opt (Alt) key, and choose Reconnect Nodes on All Masters from the context menu.")
		linePos += lineHeight
		
		self.w.includeNonExporting = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Include non-exporting glyphs", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.includeNonExporting.getNSButton().setToolTip_("Also check in glyphs that are not set to export. Recommended if you have modular components in the font.")
		linePos += lineHeight
		
		self.w.openTabWithAffectedLayers = vanilla.CheckBox( (inset, linePos-1, 200, 20), u"New tab with affected layers", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.openTabWithAffectedLayers.getNSButton().setToolTip_("If checked, will open a new tab with all layers that contain duplicate coordinates. Otherwise, will report in Macro Window only.")
		self.w.reuseTab = vanilla.CheckBox( (inset+200, linePos-1, -inset, 20), u"Reuse current tab", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.reuseTab.getNSButton().setToolTip_("If enabled, will only open a new tab if there is none open yet. Otherwise will always open a new tab.")
		linePos += lineHeight
		
		self.w.progress = vanilla.ProgressBar((inset, linePos, -inset, 16))
		self.w.progress.set(0) # set progress indicator to zero
		linePos+=lineHeight
		
		self.w.statusText = vanilla.TextBox( (inset, -20-inset, -80-inset, -inset), u"🤖 Ready.", sizeStyle='small', selectable=True )
		linePos += lineHeight
		
		
		# Run Button:
		self.w.runButton = vanilla.Button( (-80-inset, -20-inset, -inset, -inset), "Fire", sizeStyle='regular', callback=self.RewireFireMain )
		self.w.setDefaultButton( self.w.runButton )
		
		# Load Settings:
		if not self.LoadPreferences():
			print("Note: 'Rewire Fire' could not load preferences. Will resort to defaults")
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
Ejemplo n.º 22
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 310
		windowHeight = 300
		windowWidthResize  = 50 # 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
			"Garbage Collection", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.GarbageCollection.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		linePos, inset, lineHeight = 12, 12, 22
		self.w.descriptionText = vanilla.TextBox( (inset, linePos+2, -inset, lineHeight*1.8), u"Removes the following items from the glyphs in the frontmost font:", sizeStyle='small', selectable=True )
		linePos += 1.8*lineHeight
		
		self.w.removeNodeNames = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Remove all node names 🔥❌👌🏻 in font", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.removeNodeNames.getNSButton().setToolTip_(u"Deletes node markers, as employed by many mekkablue scripts to mark problematic spots.")
		linePos += lineHeight
		
		self.w.removeAnnotations = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Remove all annotations in font", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.removeAnnotations.getNSButton().setToolTip_(u"Deletes annotations created with the Annotation Tool (A), e.g. circles, arrows, and texts.")
		linePos += lineHeight
		
		self.w.removeLocalGuides = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Remove all local (blue) guides in font", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.removeLocalGuides.getNSButton().setToolTip_("Deletes blue guides.")
		linePos += lineHeight
		
		self.w.removeGlobalGuides = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Remove all global (red) guides in font", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.removeGlobalGuides.getNSButton().setToolTip_("Deletes red guides.")
		linePos += lineHeight
		
		self.w.removeGlyphNotes = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Remove all glyph notes in font", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.removeGlyphNotes.getNSButton().setToolTip_("Deletes glyph notes as entered in list view or through the Glyph Note Palette (plug-in).")
		linePos += lineHeight
		
		self.w.removeColors = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Remove all glyph and layer colors in font", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.removeColors.getNSButton().setToolTip_("Resets all glyph and layer colors to none.")
		linePos += lineHeight
		
		self.w.currentMasterOnly = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Limit clean-up to current master only", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.currentMasterOnly.getNSButton().setToolTip_("If checked, applies the clean-up to layers of the current font master only. Exception: glyph notes are not master-specific.")
		linePos += lineHeight
		
		self.w.selectedGlyphsOnly = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Limit clean-up to selected glyphs only", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.selectedGlyphsOnly.getNSButton().setToolTip_("If checked, applies the clean-up only to selected glyphs. Otherwise, to all glyphs in the font.")
		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, -17-inset, -80-inset, 14), u"", sizeStyle='small', selectable=False )
		
		self.guiUpdate()
		
		# Run Button:
		self.w.runButton = vanilla.Button( (-80-inset, -20-inset, -inset, -inset), "Clean", sizeStyle='regular', callback=self.GarbageCollectionMain )
		self.w.setDefaultButton( self.w.runButton )
		
		# Load Settings:
		if not self.LoadPreferences():
			print( "Note: 'Garbage Collection' could not load preferences. Will resort to defaults")
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
Ejemplo n.º 23
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
            "Find 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=False,
            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()
Ejemplo n.º 24
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 360
        windowHeight = 280
        windowWidthResize = 200  # user can resize width by this value
        windowHeightResize = 0  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Compare Anchors of Frontmost Fonts",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.CompareAnchorsOfFrontmostFonts.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"Lists all differences in anchor structures and positions in a detailed report in the Macro Window.",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight * 2

        self.w.reportAnchorHeights = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Also report differences in anchor heights",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.reportAnchorHeights.getNSButton().setToolTip_(
            "Lists anchors in corresponding glyphs if their y coordinates differ more than the threshold set below. Otherwise, only report anchor structures."
        )
        linePos += lineHeight

        self.w.anchorHeightToleranceText = vanilla.TextBox(
            (inset * 2, linePos + 2, 120, 14),
            u"Deviation tolerance:",
            sizeStyle='small',
            selectable=True)
        self.w.anchorHeightTolerance = vanilla.EditText(
            (inset * 2 + 120, linePos, -inset, 19),
            "0",
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.anchorHeightTolerance.getNSTextField().setToolTip_(
            u"Will not report if the difference in y coordinates is less or same as the given tolerance. Use this if e.g. your x-height is different in your italic. Set to zero or leave blank for exact match."
        )
        linePos += lineHeight

        self.w.ignoreExitEntry = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Ignore exit and entry anchors",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.ignoreExitEntry.getNSButton().setToolTip_(
            "Will skip cursive attachment anchors (#)exit and (#)entry.")
        linePos += lineHeight

        self.w.ignoreHashtaggedAnchors = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Ignore #hashtagged anchors",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.ignoreHashtaggedAnchors.getNSButton().setToolTip_(
            "Will skip anchors that start with # or _#.")
        linePos += lineHeight

        self.w.reportOnlyTopBottomCenter = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Report only top, bottom, center and corresponding anchors",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.reportOnlyTopBottomCenter.getNSButton().setToolTip_(
            "Only reports default mark attachment anchors top, _top, bottom, _bottom, center and _center. Ignores other anchors such as ogonek or topright. This option makes the ignore options above obsolete."
        )
        linePos += lineHeight

        self.w.includeNonExporting = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Include non-exporting glyphs (recommended)",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.includeNonExporting.getNSButton().setToolTip_(
            "Also report if glyph is set to not export. Recommended because non-exporting glyphs may appear as components in other glyphs."
        )
        linePos += lineHeight

        self.w.openTabAndSelectAnchors = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Open tabs with affected glyph layers and preselect anchors",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.openTabAndSelectAnchors.getNSButton().setToolTip_(
            "Opens the affected glyph layers in a tab per font, resets the selection, and selects the affected anchors for immediate editing. To take advantage of the selection, do not double click a glyph for editing (the click resets the selection), but open them with the Esc key or by switching to the Edit tool."
        )
        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),
            "Compare",
            sizeStyle='regular',
            callback=self.CompareAnchorsOfFrontmostFontsMain)
        self.w.setDefaultButton(self.w.runButton)

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

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Ejemplo n.º 25
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()
Ejemplo n.º 26
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 430
        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
            "Travel Tracker",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.TravelTracker.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"Finds master-compatible glyphs with nodes that travel more than they should because they interpolate with a wrong node in the other master(s).",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight * 1.8

        self.w.travelPercentageText = vanilla.TextBox(
            (inset, linePos + 2.5, 190, 14),
            u"Acceptable travel ratio in percent:",
            sizeStyle='small',
            selectable=True)
        self.w.travelPercentage = vanilla.EditText(
            (inset + 190, linePos, -inset, 19),
            "50",
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.travelPercentage.getNSTextField().setToolTip_(
            u"Anything above 50% is suspicious in a weight interpolation, and above 70% in a width interpolation. (100% is the diagonal of the bounding box of the path the node belongs to.)"
        )
        linePos += lineHeight

        self.w.includeNonExporting = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Include non-exporting glyphs (recommended)",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.includeNonExporting.getNSButton().setToolTip_(
            u"Important if you are using non-exporting glyphs as components inside others, e.g., the slash in the oslash."
        )
        linePos += lineHeight

        self.w.normalizePathPosition = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Normalize path origin (recommended)",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.normalizePathPosition.getNSButton().setToolTip_(
            u"Calculates node travel distances as if every path’s origin point were x=0, y=0."
        )
        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.TravelTrackerMain)
        self.w.setDefaultButton(self.w.runButton)

        # Load Settings:
        if not self.LoadPreferences():
            print(
                "Note: 'Travel Tracker' 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 = 310
        windowHeight = 270
        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 += int(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')
        self.w.checkInstances.getNSPopUpButton().setToolTip_(
            "Where to count paths (for comparison of path counts). Shapeshifting is most visible in midway interpolations (50%% between masters), so pick that option if you have two masters only, or all masters on a single axis."
        )
        linePos += lineHeight

        self.w.alsoCheckMasters = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            "Add masters as instances",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        self.w.alsoCheckMasters.getNSButton().setToolTip_(
            "Count paths in (uninterpolated) masters as well. Useful in combination with ‘constructed midway instances’ option above."
        )
        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, 170, 20),
                                          "Open tab with shapeshifters",
                                          value=True,
                                          callback=self.SavePreferences,
                                          sizeStyle='small')
        self.w.reuseTab = vanilla.CheckBox(
            (inset + 170, linePos - 1, -inset, 20),
            "Reuse current tab",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.allFonts = vanilla.CheckBox((inset, linePos - 1, -inset, 20),
                                           "⚠️ Process ALL open fonts",
                                           value=False,
                                           callback=self.SavePreferences,
                                           sizeStyle='small')
        self.w.allFonts.getNSButton().setToolTip_(
            "If enabled, will process all fonts currently opened. Careful, may take a while."
        )
        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)

        self.w.status = vanilla.TextBox((inset, -17 - inset, -90 - inset, 14),
                                        "",
                                        sizeStyle='small',
                                        selectable=False)

        # 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()
Ejemplo n.º 28
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 350
        windowHeight = 280
        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
            "New Tab with Transformed Components",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.NewTabWithTransformedComponents.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"Finds and displays components that are transformed:",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight

        self.w.findScaled = vanilla.CheckBox((inset, linePos - 1, -inset, 20),
                                             u"Find scaled components",
                                             value=True,
                                             callback=self.SavePreferences,
                                             sizeStyle='small')
        linePos += lineHeight

        self.w.findUnproportionallyScaled = vanilla.CheckBox(
            (inset * 2, linePos - 1, -inset, 20),
            u"Only unproportionally scaled (h≠v)",
            value=True,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.findRotated = vanilla.CheckBox((inset, linePos - 1, -inset, 20),
                                              u"Find rotated components",
                                              value=False,
                                              callback=self.SavePreferences,
                                              sizeStyle='small')
        linePos += lineHeight

        self.w.findMirrored = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Find flipped components",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.findShifted = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Find shifted (otherwise untransformed) components",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.includeNonexporting = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Include non-exporting glyphs",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.includeInactiveLayers = vanilla.CheckBox(
            (inset, linePos - 1, -inset, 20),
            u"Include inactive backup layers",
            value=False,
            callback=self.SavePreferences,
            sizeStyle='small')
        linePos += lineHeight

        self.w.reuseTab = vanilla.CheckBox((inset, linePos - 1, -inset, 20),
                                           u"Reuse current 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(
            (-110 - inset, -20 - inset, -inset, -inset),
            "Open Tab",
            sizeStyle='regular',
            callback=self.NewTabWithTransformedComponentsMain)
        self.w.setDefaultButton(self.w.runButton)

        # Load Settings:
        if not self.LoadPreferences():
            print(
                "Note: 'New Tab with Transformed Components' could not load preferences. Will resort to defaults"
            )

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
Ejemplo n.º 30
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 320
		windowHeight = 470
		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
			"Path Problem Finder", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.PathProblemFinder.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		linePos, inset, lineHeight = 12, 15, 22
		indent = 170
		self.w.descriptionText = vanilla.TextBox( (inset, linePos+2, -inset, 14), u"New tab with layers containing path problems:", sizeStyle='small', selectable=True )
		linePos += lineHeight
		
		self.w.zeroHandles = vanilla.CheckBox( (inset, linePos, -inset, 20), u"Zero handles", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.zeroHandles.getNSButton().setToolTip_(u"Zero handles (a.k.a. half-dead curves) can cause problems with screen rendering, hinting and interpolation. Indicated with purple disks in the Show Angled Handles plug-in.")
		linePos += lineHeight
		
		self.w.outwardHandles = vanilla.CheckBox( (inset, linePos, -inset, 20), u"Outward-bent handles", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.outwardHandles.getNSButton().setToolTip_(u"Will find handles that point outside the stretch of their enclosing on-curves. Usually unwanted.")
		linePos += lineHeight
		
		self.w.largeHandles = vanilla.CheckBox( (inset, linePos, -inset, 20), u"Overshooting handles (larger than 100%)", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.largeHandles.getNSButton().setToolTip_(u"Handles that are longer than 100%, i.e. going beyond the intersection with the opposing handle. Indicated with laser beams in the Show Angled Handles plug-in.")
		linePos += lineHeight
		
		self.w.shortHandles = vanilla.CheckBox( (inset, linePos, indent, 20), u"Handles shorter than:", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.shortHandlesThreshold = vanilla.EditText( (inset+indent, linePos, -inset-55, 19), "12", callback=self.SavePreferences, sizeStyle='small' )
		self.w.shortHandlesText = vanilla.TextBox( (-inset-50, linePos+2, -inset, 14), u"units", sizeStyle='small', selectable=True )
		tooltipText = u"Will find handles shorter than the specified amount in units. Short handles may cause kinks when rounded to the grid."
		self.w.shortHandlesThreshold.getNSTextField().setToolTip_(tooltipText)
		self.w.shortHandles.getNSButton().setToolTip_(tooltipText)
		linePos += lineHeight
		
		self.w.angledHandles = vanilla.CheckBox( (inset, linePos, indent, 20), u"Angled handles up to:", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.angledHandlesAngle = vanilla.EditText( (inset+indent, linePos, -inset-55, 19), "8", callback=self.SavePreferences, sizeStyle='small' )
		self.w.angledHandlesText = vanilla.TextBox( (-inset-50, linePos+2, -inset, 14), u"degrees", sizeStyle='small', selectable=True )
		linePos += lineHeight
		
		self.w.shallowCurveBBox = vanilla.CheckBox( (inset, linePos, indent, 20), u"Curve bbox smaller than:", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.shallowCurveBBoxThreshold = vanilla.EditText( (inset+indent, linePos, -inset-55, 19), "10", sizeStyle='small' )
		self.w.shallowCurveBBoxText = vanilla.TextBox( (-inset-50, linePos+2, -inset, 14), u"units", sizeStyle='small', selectable=True )
		tooltipText = u"Will find very flat curve segments. Flat curves leave little manœuvring space for handles (BCPs), or cause very short handles, which in turn causes grid rounding problems. Can usually be fixed by removing an extremum point or adding an overlap."
		self.w.shallowCurveBBoxThreshold.getNSTextField().setToolTip_(tooltipText)
		self.w.shallowCurveBBox.getNSButton().setToolTip_(tooltipText)
		linePos += lineHeight
		
		self.w.shallowCurve = vanilla.CheckBox( (inset, linePos, indent, 20), u"Curves shallower than:", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.shallowCurveThreshold = vanilla.EditText( (inset+indent, linePos, -inset-55, 19), "5", sizeStyle='small' )
		self.w.shallowCurveText = vanilla.TextBox( (-inset-50, linePos+2, -inset, 14), u"units", sizeStyle='small', selectable=True )
		tooltipText = u"Finds curve segments where the handles deviate less than the specified threshold from the enclosing on-curves."
		self.w.shallowCurveThreshold.getNSTextField().setToolTip_(tooltipText)
		self.w.shallowCurve.getNSButton().setToolTip_(tooltipText)
		linePos += lineHeight
		
		self.w.shortLine = vanilla.CheckBox( (inset, linePos, indent, 20), u"Line segments shorter than:", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.shortLineThreshold = vanilla.EditText( (inset+indent, linePos, -inset-55, 19), "8", sizeStyle='small' )
		self.w.shortLineText = vanilla.TextBox( (-inset-50, linePos+2, -inset, 14), u"units", sizeStyle='small', selectable=True )
		tooltipText = u"Finds line segments (two consecutive on-curve nodes) shorter than the specified threshold length. Very short line segments may be deleted because they are barely visible. Also, if not orthogonal, may pose grid rounding problems."
		self.w.shortLineThreshold.getNSTextField().setToolTip_(tooltipText)
		self.w.shortLine.getNSButton().setToolTip_(tooltipText)
		linePos += lineHeight
		
		self.w.almostOrthogonalLines = vanilla.CheckBox( (inset, linePos, indent, 20), u"Non-orthogonal lines:", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.almostOrthogonalLinesThreshold = vanilla.EditText( (inset+indent, linePos, -inset-75, 19), "3", callback=self.SavePreferences, sizeStyle='small' )
		self.w.almostOrthogonalLinesText = vanilla.TextBox( (-inset-70, linePos+2, -inset, 14), u"units deep", sizeStyle='small', selectable=True )
		tooltipText = u"Will find line segments that are close to, but not completely horizontal or vertical. Will look for segments where the x or y distance between the two nodes is less than the specified threshold. Often unintentional."
		self.w.almostOrthogonalLinesThreshold.getNSTextField().setToolTip_(tooltipText)
		self.w.almostOrthogonalLines.getNSButton().setToolTip_(tooltipText)
		linePos += lineHeight
		
		self.w.badOutlineOrder = vanilla.CheckBox( (inset, linePos, -inset, 20), u"Bad outline order", value=False, callback=self.SavePreferences, sizeStyle='small' )
		self.w.badOutlineOrder.getNSButton().setToolTip_(u"If the first path is clockwise, paths are most likely in the wrong order.")
		linePos += lineHeight
		
		self.w.twoPointOutlines = vanilla.CheckBox( (inset, linePos, -inset, 20), u"Paths with two on-curve nodes only", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.twoPointOutlines.getNSButton().setToolTip_(u"Paths with only two on-curve nodes are most likely leftover debris from a previous operation.")
		linePos += lineHeight
		
		self.w.offcurveAsStartPoint = vanilla.CheckBox( (inset, linePos, -inset, 20), u"Off-curve point (handle) as startpoint", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.offcurveAsStartPoint.getNSButton().setToolTip_(u"Finds paths where the first point happens to be a BCP. Not really an issue, but you’ll like it if you are going full OCD on your font.")
		linePos += lineHeight
		
		self.w.openPaths = vanilla.CheckBox( (inset, linePos, -inset, 20), u"Open paths (except _corner, _cap, etc.)", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.openPaths.getNSButton().setToolTip_(u"Finds unclosed paths. Special glyphs that are supposed to have open paths, like corner and cap components, are ignored.")
		linePos += lineHeight
		
		self.w.line = vanilla.HorizontalLine( (inset, linePos+3, -inset, 1))
		linePos += int(lineHeight/2)
		
		# Script Options:
		self.w.includeAllGlyphs = vanilla.CheckBox( (inset, linePos, -inset, 20), u"Check complete font (i.e., ignore glyph selection)", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.includeAllGlyphs.getNSButton().setToolTip_(u"If enabled, will ignore your current (glyph) selection, and simply go through the complete font. Recommended. May still ignore non-exporting glyph, see following option.")
		linePos += lineHeight
		
		self.w.includeNonExporting = vanilla.CheckBox( (inset, linePos, -inset, 20), u"Include non-exporting glyphs", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.includeNonExporting.getNSButton().setToolTip_(u"If disabled, will ignore glyphs that are set to not export.")
		linePos += lineHeight
		
		self.w.reuseTab = vanilla.CheckBox( (inset, linePos, -inset, 20), u"Reuse existing tab", value=True, callback=self.SavePreferences, sizeStyle='small' )
		self.w.reuseTab.getNSButton().setToolTip_(u"If enabled, will only open a new tab if none is open. Recommended.")
		linePos += lineHeight
		
		# Progress Bar and Status text:
		self.w.progress = vanilla.ProgressBar((inset, linePos, -inset, 16))
		self.w.progress.set(0) # set progress indicator to zero
		self.w.status = vanilla.TextBox( (inset, -18-inset, -inset-100, 14), u"🤖 Ready.", sizeStyle='small', selectable=True )
		linePos += lineHeight
		
		# Run Button:
		self.w.runButton = vanilla.Button( (-100-inset, -20-inset, -inset, -inset), "Open Tab", sizeStyle='regular', callback=self.PathProblemFinderMain )
		self.w.setDefaultButton( self.w.runButton )
		
		# Load Settings:
		if not self.LoadPreferences():
			print("Note: 'Path Problem Finder' could not load preferences. Will resort to defaults")
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()