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)
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)) pen.endPath() offsetFilter.offsetLayer_offsetX_offsetY_makeStroke_autoStroke_position_metrics_error_shadow_capStyleStart_capStyleEnd_keepCompatibleOutlines_( layer, h / 2, v / 2, # horizontal and vertical offset True, # if True, creates a stroke False, # if True, distorts resulting shape to vertical metrics 0.5, # stroke distribution to the left and right, 0.5 = middle None, None, None, 0, 0, False) layer.correctPathDirection() if not font.glyphs['plus']: glyph = GSGlyph('plus') 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]