Exemple #1
0
 def doOffset(self, Layer, hoffset, voffset):
     try:
         offsetCurveFilter = NSClassFromString("GlyphsFilterOffsetCurve")
         offsetCurveFilter.offsetLayer_offsetX_offsetY_makeStroke_autoStroke_position_error_shadow_(
             Layer, hoffset, voffset, False, False, 0.5, None, None)
     except Exception as e:
         print("offset failed")
Exemple #2
0
 def expandMonoline(self, Layer, noodleRadius):
     try:
         offsetCurveFilter = NSClassFromString("GlyphsFilterOffsetCurve")
         offsetCurveFilter.offsetLayer_offsetX_offsetY_makeStroke_autoStroke_position_error_shadow_(
             Layer, noodleRadius, noodleRadius, True, False, 0.5, None,
             None)
         Layer.correctPathDirection()
     except Exception as e:
         print(
             ("expandMonoline: %s\n%s" % (str(e), traceback.format_exc())))
Exemple #3
0
 def expandMonolineFromPathlist(self, Paths, noodleRadius):
     Layer = GSLayer()
     for p in Paths:
         Layer.paths.append(p)
     try:
         offsetCurveFilter = NSClassFromString("GlyphsFilterOffsetCurve")
         offsetCurveFilter.offsetLayer_offsetX_offsetY_makeStroke_autoStroke_position_error_shadow_(
             Layer, noodleRadius, noodleRadius, True, False, 0.5, None,
             None)
         Layer.correctPathDirection()
         monopaths = Layer.paths
         del Layer
         return monopaths
     except Exception as e:
         print(
             ("expandMonoline: %s\n%s" % (str(e), traceback.format_exc())))
Exemple #4
0
	def init(self):
		"""
		Do all initializing here.
		"""
		try:
			# Settings, default values
			self.name = 'My File Format'
			self.icon = 'ExportIcon'
			self.toolbarPosition = 100
			
			if hasattr(self, 'settings'):
				self.settings()
			
			# Dialog stuff
			# Initiate empty self.dialog here in case of Vanilla dialog,
			# where .dialog is not defined at the class’s root.
			if not hasattr(self, 'dialog'):
				self.dialog = None
			
			thisBundle = NSBundle.bundleForClass_(NSClassFromString(self.className()))
			self.toolbarIcon = NSImage.alloc().initWithContentsOfFile_(thisBundle.pathForImageResource_(self.icon))
			self.toolbarIcon.setName_(self.icon)
			
			if hasattr(self, 'start'):
				self.start()
		
		except:
			self.logError(traceback.format_exc())
		
		return self
Exemple #5
0
def offsetLayer(thisLayer,
                offset,
                makeStroke=False,
                position=0.5,
                autoStroke=False):
    offsetFilter = NSClassFromString("GlyphsFilterOffsetCurve")
    try:
        # GLYPHS 3:
        offsetFilter.offsetLayer_offsetX_offsetY_makeStroke_autoStroke_position_metrics_error_shadow_capStyleStart_capStyleEnd_keepCompatibleOutlines_(
            thisLayer,
            offset,
            offset,  # horizontal and vertical offset
            makeStroke,  # if True, creates a stroke
            autoStroke,  # if True, distorts resulting shape to vertical metrics
            position,  # stroke distribution to the left and right, 0.5 = middle
            None,
            None,
            None,
            0,
            0,
            False)
    except:
        # GLYPHS 2:
        offsetFilter.offsetLayer_offsetX_offsetY_makeStroke_autoStroke_position_error_shadow_(
            thisLayer,
            offset,
            offset,  # horizontal and vertical offset
            makeStroke,  # if True, creates a stroke
            autoStroke,  # if True, distorts resulting shape to vertical metrics
            position,  # stroke distribution to the left and right, 0.5 = middle
            None,
            None)
	def GetTransformOrigin( self, sender ):
		try:
			myController = Glyphs.currentDocument.windowController()
			rotateToolClass = NSClassFromString("GlyphsToolRotate")
			myRotateTool = myController.toolForClass_( rotateToolClass )
			currentOrigin = myRotateTool.transformOrigin()
						
			self.w.originX.set( currentOrigin.x )
			self.w.originY.set( currentOrigin.y )
		except:
			return False
			
		return True
Exemple #7
0
	def notdefLayer( self ):
		try:
			from Foundation import NSBundle, NSClassFromString, NSDictionary
			bundle = NSBundle.bundleForClass_(NSClassFromString("GSExportInstanceOperation"))
			if bundle:
				path = bundle.pathForResource_ofType_("notDef","plist")
				layerDict = NSDictionary.dictionaryWithContentsOfFile_(path)
				layer = GSLayer.alloc().initWithDict_format_(layerDict,1)
				return layer
			return None
		except Exception as e:
			import traceback
			print(traceback.format_exc())
			self.logToConsole( "notdefLayer: %s" % str(e) )
			return None
    def SetTransformOriginMain(self, sender):
        try:
            newOriginX = float(self.w.originX.get())
            newOriginY = float(self.w.originY.get())
            newOriginPoint = NSPoint(newOriginX, newOriginY)

            myController = Glyphs.currentDocument.windowController()
            myController.graphicView().setNeedsDisplay_(False)

            rotateToolClass = NSClassFromString("GlyphsToolRotate")
            myRotateTool = myController.toolForClass_(rotateToolClass)
            myRotateTool.setTransformOrigin_(newOriginPoint)

            myController.graphicView().setNeedsDisplay_(True)

        except Exception, e:
            # brings macro window to front and reports error:
            Glyphs.showMacroWindow()
            print "Set Transform Origin Error: %s" % e
Exemple #9
0
	def currentWindowController(self):
		"""
		Returns a window controller object.
		Use self.currentWindowController() to access it.
		"""
		try:
			windowController = None
			try:
				windowController = NSDocumentController.sharedDocumentController().currentDocument().windowController()
				if not windowController and sender.respondsToSelector_("object"):
					if sender.object().__class__ == NSClassFromString("GSFont"):
						Font = sender.object()
						windowController = Font.parent().windowControllers()[0]
						self.logToConsole("__windowController1", windowController)
					else:
						windowController = sender.object()
						self.logToConsole("__windowController2", windowController)
			except:
				pass
			return windowController
		except:
			self.logError(traceback.format_exc())
Exemple #10
0
	def init(self):
		"""
		By default, toolbar.pdf will be your tool icon.
		Use this for any initializations you need.
		"""
		try:
			self = objc.super(SelectTool, self).init()
			self.name = 'My Select Tool'
			self.toolbarPosition = 100
			self._icon = 'toolbar.pdf'
			self.keyboardShortcut = None
			self.generalContextMenus = ()
			
			# Inspector dialog stuff
			# Initiate self.inspectorDialogView here in case of Vanilla dialog,
			# where inspectorDialogView is not defined at the class’s root.
			if not hasattr(self, 'inspectorDialogView'):
				self.inspectorDialogView = None
			
			if hasattr(self, 'settings'):
				self.settings()
			try:
				if hasattr(self, "__file__"):
					path = self.__file__()
					Bundle = NSBundle.bundleWithPath_(path[:path.rfind("Contents/Resources/")])
				else:
					Bundle = NSBundle.bundleForClass_(NSClassFromString(self.className()));
				if self._icon != None:
					self.tool_bar_image = Bundle.imageForResource_(self._icon)
					self.tool_bar_image.setTemplate_(True) # Makes the icon blend in with the toolbar.
			except:
				self.logError(traceback.format_exc())
			if hasattr(self, 'start'):
				self.start()
			
			return self
		except:
			self.logError(traceback.format_exc())
		return objc.nil
Exemple #11
0
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__ = """
Realigns handles (BCPs) in current layers of selected glyphs. Useful for resetting out-of-sync handles, e.g., after a transform operation, after interpolation or after switching to a different grid. Hold down Option to process ALL layers of the glyph.
"""

from Foundation import NSPoint, NSEvent, NSNumber, NSMutableArray, NSClassFromString

optionKeyFlag = 524288
optionKeyPressed = NSEvent.modifierFlags() & optionKeyFlag == optionKeyFlag

thisFont = Glyphs.font
moveForward = NSPoint(1, 1)
moveBackward = NSPoint(-1, -1)
noModifier = NSNumber.numberWithUnsignedInteger_(0)
Tool = NSClassFromString("GlyphsPathPlugin").alloc().init()


def realignLayer(thisLayer):
    countOfHandlesOnLayer = 0
    for thisPath in thisLayer.paths:
        for thisNode in thisPath.nodes:
            if thisNode.type == GSOFFCURVE:
                countOfHandlesOnLayer += 1
                selectedNode = NSMutableArray.arrayWithObject_(thisNode)
                thisLayer.setSelection_(selectedNode)
                Tool.moveSelectionLayer_shadowLayer_withPoint_withModifier_(
                    thisLayer, thisLayer, moveForward, noModifier)
                Tool.moveSelectionLayer_shadowLayer_withPoint_withModifier_(
                    thisLayer, thisLayer, moveBackward, noModifier)
    thisLayer.setSelection_(())
Exemple #12
0
#MenuTitle: Decompose Corner and Cap Components
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
from builtins import str

__doc__ = """
Recreates the current paths without caps or components.
"""

from Foundation import NSClassFromString

thisFont = Glyphs.font  # frontmost font
selectedLayers = thisFont.selectedLayers  # active layers of selected glyphs
removeOverlapFilter = NSClassFromString(
    "GlyphsFilterRemoveOverlap").alloc().init()
gridSize = float(thisFont.gridMain()) / thisFont.gridSubDivision()


def removeCorners(thisLayer):
    numOfHints = len(thisLayer.hints)
    for i in range(numOfHints)[::-1]:
        if thisLayer.hints[i].type == 16:  # corner
            thisLayer.removeObjectFromHintsAtIndex_(i)


def removeCaps(thisLayer):
    numOfHints = len(thisLayer.hints)
    for i in range(numOfHints)[::-1]:
        if thisLayer.hints[i].type == 17:  # cap
            thisLayer.removeObjectFromHintsAtIndex_(i)
Exemple #13
0
path_to_lock_sound = 'ArmingChirp.mp3'
path_to_warn_sound = 'CarAlarm.mp3'

import time
import objc
from objc import NO
from Foundation import NSBundle, NSClassFromString, NSObject, NSRunLoop, NSDate, NSUUID, NSMakeRange, NSURL
from AVFoundation import AVAudioPlayer
import Quartz

global lock_player
global warn_player

CoreBluetooth = NSBundle.bundleWithIdentifier_('com.apple.CoreBluetooth')
_ = CoreBluetooth.load()
CBCentralManager = NSClassFromString('CBCentralManager')
CBUUID = NSClassFromString('CBUUID')

constants = [
    ('CBCentralManagerScanOptionAllowDuplicatesKey', '@'),
    ('CBAdvertisementDataManufacturerDataKey', '@'),
    ('CBAdvertisementDataServiceUUIDsKey', '@'),
]

objc.loadBundleVariables(CoreBluetooth, globals(), constants)

Login = NSBundle.bundleWithPath_(
    '/System/Library/PrivateFrameworks/login.framework')
functions = [
    ('SACLockScreenImmediate', '@'),
]
Exemple #14
0
	def noodleLayer( self, thisLayer, noodleThickness, extremesAndInflections, removeOverlap, noodleBezierPath ):
		# Catch a crash:
		if noodleThickness == 0.0:
			noodleThickness = 1.0

		Layer = thisLayer.copy()
		
		if Layer.paths:
			noodleRadius = noodleThickness * 0.5
			
			# Collect circle positions:
			circleCenters = []
			for thisPath in Layer.paths:
				numOfNodesInPath = len(thisPath.nodes)
				if thisPath.closed == False and numOfNodesInPath > 1:
					firstPoint = thisPath.nodes[0].position
					secondPoint = thisPath.nodes[1].position
					circleCenters.append( [firstPoint, secondPoint] )

					lastPoint = thisPath.nodes[ numOfNodesInPath-1 ].position
					lastButOnePoint = thisPath.nodes[ numOfNodesInPath-2 ].position
					circleCenters.append( [lastPoint, lastButOnePoint] )

			# Add extremes and inflections:
			if extremesAndInflections:
				Layer.addExtremePoints()
				Layer.addInflectionPoints()
				
			# Expand monoline:
			self.expandMonoline( Layer, noodleRadius )

			# Add circle endings:
			for thisNodePair in circleCenters:
				circleCenter = thisNodePair[0]
				if self.isARealEnd( circleCenter, noodleBezierPath ):
					circleAtThisPosition = self.drawCircle( circleCenter, noodleRadius )
					try:
						# GLYPHS 3:
						Layer.shapes.append( circleAtThisPosition )
					except:
						# GLYPHS 2:
						Layer.paths.append( circleAtThisPosition )

			# Remove overlaps:
			if removeOverlap:
				if Layer.bounds.origin.x + Layer.bounds.size.width > 8190.0:
					centerX = Layer.bounds.origin.x + Layer.bounds.size.width * 0.5
					if centerX < 0.0:
						print("Warning: glyph '%s' too wide for overlap removal!" % Layer.parent.name)
					else:
						leftShiftMatrix = self.transform(shiftX=-centerX).transformStruct()
						rightShiftMatrix = self.transform(shiftX=centerX).transformStruct()
						Layer.applyTransform(leftShiftMatrix)
						Layer.removeOverlap()
						Layer.applyTransform(rightShiftMatrix)
				else:	
					Layer.removeOverlap()

			# Round Corners:
			roundCornerFilter = NSClassFromString("GlyphsFilterRoundCorner")
			roundCornerFilter.roundLayer_radius_checkSelection_visualCorrect_grid_( Layer, noodleRadius, False, True, False )
		
		# Tidy up paths:
		Layer.cleanUpPaths()
		
		return Layer
	def removeOverlap(self):
		removeOverlapFilter = NSClassFromString("GlyphsFilterRemoveOverlap").alloc().init()
		removeOverlapFilter.runFilterWithLayer_error_(self._layer, None)
Exemple #16
0
#!/usr/bin/python
#ref: https://gist.github.com/pudquick/8d3dedc337161b187a8a1c9564c83463

# For an alternative method, check out:
# https://gist.github.com/pudquick/3ff4278c609ce223ebb4fc300c5edd0f

from Foundation import NSBundle, NSClassFromString
SafariShared = NSBundle.bundleWithPath_(
    '/System/Library/PrivateFrameworks/SafariShared.framework')
loaded = SafariShared.load()
WBSPasswordGeneration = NSClassFromString('WBSPasswordGeneration')
CKRecord = NSClassFromString('CKRecord')


def generate_password(requirements=None):
    rec = CKRecord.alloc().initWithRecordType_('pudquick_passwordgen')
    if requirements is not None:
        # dictionary of values to set passed in
        rec.setValuesForKeysWithDictionary_(requirements)
    password = WBSPasswordGeneration.generatedPasswordMatchingRequirements_(
        rec)
    # Do a little cleanup, since we don't actually want to save any CloudKit records
    del rec
    return password


# Example usage
# >>> generate_password()
# u'hhs-o7X-kaZ-ngw'
# Returns an iCloud Keychain suggested password in the style seen here:
# https://support.apple.com/library/APPLE/APPLECARE_ALLGEOS/Product_Help/en_US/PUBLIC_USERS/PL124/S0700_CloudKeychain.png
            returnValue = True
    if count:
        print("   %i TT Stem Hint%s set to ‘No Stem’." % (
            count,
            "" if count == 1 else "s",
        ))
    return returnValue


# brings macro window to front and clears its log:
Glyphs.clearLog()
Glyphs.showMacroWindow()
print("TT Autoinstruct: %s" % thisFont.familyName)
thisFont.disableUpdateInterface()  # suppresses UI updates in Font View
try:
    Tool = NSClassFromString("GlyphsToolTrueTypeInstructor").alloc().init()
    if Tool:
        Tool.autohintLayers_(selectedLayers)
        for thisLayer in selectedLayers:
            hintCount = len([
                h for h in thisLayer.hints
                if h.type in (TTANCHOR, TTSTEM, TTALIGN, TTINTERPOLATE,
                              TTDIAGONAL, TTDELTA)
            ])
            print("\n🔠 %s\n   Layer ‘%s’ has %i TT instruction%s." % (
                thisLayer.parent.name,
                thisLayer.name,
                hintCount,
                "" if hintCount == 1 else "s",
            ))
            if shouldSetStemsToNoStem:
Exemple #18
0
        major, minor = s.groups()
        if not (int(major) == 5 and int(minor) >= 43):
            raise BleakError(
                "Bleak requires BlueZ >= 5.43. Found version {0} installed.".
                format(out))

    from bleak.backends.bluezdbus.discovery import discover  # noqa
    from bleak.backends.bluezdbus.scanner import (
        BleakScannerBlueZDBus as BleakScanner, )  # noqa
    from bleak.backends.bluezdbus.client import (
        BleakClientBlueZDBus as BleakClient, )  # noqa
elif platform.system() == "Darwin":
    from Foundation import NSClassFromString

    if NSClassFromString("CBPeripheral") is None:
        raise BleakError("Bleak requires the CoreBluetooth Framework")

    from bleak.backends.corebluetooth.discovery import discover  # noqa
    from bleak.backends.corebluetooth.scanner import (
        BleakScannerCoreBluetooth as BleakScanner, )  # noqa
    from bleak.backends.corebluetooth.client import (
        BleakClientCoreBluetooth as BleakClient, )  # noqa

elif platform.system() == "Windows":
    # Requires Windows 10 Creators update at least, i.e. Window 10.0.16299
    _vtup = platform.win32_ver()[1].split(".")
    if int(_vtup[0]) != 10:
        raise BleakError(
            "Only Windows 10 is supported. Detected was {0}".format(
                platform.win32_ver()))
Exemple #19
0
approved_UUIDs = ['your-beacon-UUID-here']  # see line 64
path_to_lock_sound = '/Users/frogor/Desktop/car_lock.m4a'
path_to_warn_sound = '/Users/frogor/Desktop/viper_warning.m4a'

import time
import objc
from objc import NO
from Foundation import NSBundle, NSClassFromString, NSObject, NSRunLoop, NSDate, NSUUID, NSMakeRange, NSURL
from AVFoundation import AVAudioPlayer
import Quartz
global lock_player
global warn_player

CoreBluetooth = NSBundle.bundleWithIdentifier_('com.apple.CoreBluetooth')
_ = CoreBluetooth.load()
CBCentralManager = NSClassFromString('CBCentralManager')

constants = [
    ('CBCentralManagerScanOptionAllowDuplicatesKey', '@'),
    ('CBAdvertisementDataManufacturerDataKey', '@'),
]

objc.loadBundleVariables(CoreBluetooth, globals(), constants)

Login = NSBundle.bundleWithPath_(
    '/System/Library/PrivateFrameworks/login.framework')
functions = [
    ('SACLockScreenImmediate', '@'),
]

objc.loadBundleFunctions(Login, globals(), functions)
Exemple #20
0
def enrollInSeedProgram(targetVolume, targetProductVersion):
	print "\n[ 1 ] Customer Seed"
	print "[ 2 ] Developer Seed"
	print "[ 3 ] Public Beta Seed\n"
	
	while True:
		try:
			program = int(raw_input("Select program: "))
			if program < 1 or program > 3:
				sys.stdout.write("\033[F\033[K")
			else:
				break;
		except:
			sys.stdout.write("\033[F\033[K")

	seedProgramManager = NSClassFromString('SDSeedProgramManager')
	seedProgram = seedProgramManager._stringForSeedProgram_(program)
	print "Seeding: Enrolling in seed program: %s" % seedProgram
	seedProgramManager._setSeedProgramPref_(program)
		
	if seedProgramManager._setCatalogForSeedProgram_(program) != 0:
		seedProgramManager._setHelpFeedbackMenuEnabled_((program | 2) == 3)
		seedProgramManager._setSeedOptOutUIDisabled_(0)
			
		if ((program | 2) == 3):
			seedProgramManager._createFeedbackAssistantSymlink()

	if targetProductVersion == '10.9':
		plist = getPath(targetVolume, "Library/Application Support/App Store/.SeedEnrollment.plist")
	else:
		plist = getPath(targetVolume, "Users/Shared/.SeedEnrollment.plist")

	plistlib.writePlist(dict(SeedProgram=seedProgram), plist)
Exemple #21
0
#!/usr/bin/env python

# Nicolas Seriot
# 2015-04-11

import argparse
import os
import time

from Foundation import NSBundle, NSClassFromString, NSDictionary, NSURL

success = NSBundle.bundleWithPath_("/System/Library/PrivateFrameworks/PhotoLibraryPrivate.framework/Versions/A/Frameworks/PAImaging.framework").load()
assert success == True

CIImage = NSClassFromString("CIImage")
assert CIImage

CIFilter = NSClassFromString("CIFilter")
assert CIFilter

NSBitmapImageRep = NSClassFromString("NSBitmapImageRep")
assert NSBitmapImageRep

IPAPhotoAdjustmentStackSerializer_v10 = NSClassFromString("IPAPhotoAdjustmentStackSerializer_v10")
assert IPAPhotoAdjustmentStackSerializer_v10

ipaPASS = IPAPhotoAdjustmentStackSerializer_v10.alloc().init()

def apply_cifilter_with_name(filter_name, orientation, in_path, out_path, dry_run=False):
    
    print "-- in: ", in_path
Exemple #22
0
from Foundation import NSBundle, NSClassFromString, NSDictionary, NSURL

success = NSBundle.bundleWithPath_("/System/Library/PrivateFrameworks/PhotoLibraryPrivate.framework/Versions/A/Frameworks/PAImaging.framework").load()
assert success == True

CIImage = NSClassFromString("CIImage")
assert CIImage

CIFilter = NSClassFromString("CIFilter")
assert CIFilter

NSBitmapImageRep = NSClassFromString("NSBitmapImageRep")
assert NSBitmapImageRep

IPAPhotoAdjustmentStackSerializer_v10 = NSClassFromString("IPAPhotoAdjustmentStackSerializer_v10")
assert IPAPhotoAdjustmentStackSerializer_v10

ipaPASS = IPAPhotoAdjustmentStackSerializer_v10.alloc().init()

def apply_cifilter_with_name(filter_name, orientation, in_path, out_path, dry_run=False):
    
    print "-- in: ", in_path
    print "-- out:", out_path
    
    assert in_path
    assert out_path
    
    assert filter_name in ["CIPhotoEffectTonal", "CIPhotoEffectMono", "CIPhotoEffectInstant", "CIPhotoEffectTransfer",
                           "CIPhotoEffectProcess", "CIPhotoEffectChrome", "CIPhotoEffectNoir", "CIPhotoEffectFade",
                           "CIPhotoEffect3DDramatic", "CIPhotoEffect3DVivid", "CIPhotoEffect3DDramaticCool", "CIPhotoEffect3DNoir"]
#!/usr/bin/env python
# encoding: utf-8

import objc
from Foundation import NSBundle, NSClassFromString, NSObject, NSLog, NSColor
import sys, os, re

MainBundle = NSBundle.mainBundle()
path = MainBundle.bundlePath() + "/Contents/Scripts"
if not path in sys.path:
    sys.path.append(path)

import GlyphsApp

ServiceProvider = NSClassFromString("GSServiceProvider").alloc().init()
GlyphsReporterProtocol = objc.protocolNamed("GlyphsReporter")


class ShowInterpolation(NSObject, GlyphsReporterProtocol):
    def init(self):
        """
		Put any initializations you want to make here.
		"""
        try:
            #Bundle = NSBundle.bundleForClass_( NSClassFromString( self.className() ));

            return self
        except Exception as e:
            self.logToConsole("init: %s" % str(e))

    def interfaceVersion(self):
 def removeOverlap(self):
     removeOverlapFilter = NSClassFromString(
         "GlyphsFilterRemoveOverlap").alloc().init()
     removeOverlapFilter.runFilterWithLayer_error_(self._layer, None)
Exemple #25
0
for layer in font.glyphs['hyphen'].layers:
    if layer.isMasterLayer:
        hyphen_layer = layer.copyDecomposedLayer()
        hyphen_lsb.append(layer.LSB * hyphen_factor)
        measure_x = hyphen_layer.width / 2
        start = layer.master.capHeight
        stop = layer.master.descender
        intersections = hyphen_layer.intersectionsBetweenPoints(
            (measure_x, start), (measure_x, stop))
        stem_height = (intersections[-2].y -
                       intersections[-3].y) * hyphen_thick_factor
        master_contrast.append(
            (stem_height, round(stem_height * contrast_factor)))

offsetFilter = NSClassFromString("GlyphsFilterOffsetCurve")

if not font.glyphs['minus']:
    glyph = GSGlyph('minus')
    font.glyphs.append(glyph)
    for i, layer in enumerate(glyph.layers):
        h, v = master_contrast[i]
        layer.width = zero_width[i]
        line_width = layer.width - hyphen_lsb[i]
        y_start = layer.master.capHeight / 2
        y_end = y_start
        x_start = hyphen_lsb[i]
        x_end = line_width
        pen = layer.getPen()
        pen.moveTo((x_start, y_start))
        pen.lineTo((x_end, y_start))