@@ -44,11 +44,22 @@ def init(self):
44
44
self ._upm = 1000
45
45
self ._descender = - 250
46
46
self ._bufferLeft = self ._bufferRight = self ._bufferBottom = self ._bufferTop = 15
47
+
48
+ self ._cutoffDisplayPointSizes = dict (
49
+ showFontVerticalMetrics = 150 ,
50
+ showGlyphStartPoints = 175 ,
51
+ showGlyphOnCurvePoints = 175 ,
52
+ showGlyphOffCurvePoints = 175 ,
53
+ showGlyphPointCoordinates = 250 ,
54
+ showGlyphAnchors = 50
55
+ )
47
56
48
57
self ._fitToFrame = None
49
58
50
59
self ._backgroundColor = NSColor .whiteColor ()
51
60
self ._glyphColor = NSColor .colorWithCalibratedRed_green_blue_alpha_ (0 , 0 , 0 , 1 )
61
+ self ._strokeColor = None
62
+ self ._pointColor = None
52
63
self ._alternateHighlightColor = defaultAlternateHighlightColor
53
64
self ._notdefBackgroundColor = NSColor .colorWithCalibratedRed_green_blue_alpha_ (1 , 0 , 0 , .25 )
54
65
return self
@@ -93,6 +104,14 @@ def setGlyphColor_(self, color):
93
104
self ._glyphColor = color
94
105
self .setNeedsDisplay_ (True )
95
106
107
+ def setStrokeColor_ (self , color ):
108
+ self ._strokeColor = color
109
+ self .setNeedsDisplay_ (True )
110
+
111
+ def setPointColor_ (self , color ):
112
+ self ._pointColor = color
113
+ self .setNeedsDisplay_ (True )
114
+
96
115
def setBackgroundColor_ (self , color ):
97
116
self ._backgroundColor = color
98
117
self .setNeedsDisplay_ (True )
@@ -133,7 +152,14 @@ def getDrawingAttribute_layerName_(self, attr, layerName):
133
152
return self ._fallbackDrawingAttributes .get (attr )
134
153
d = self ._layerDrawingAttributes .get (layerName , {})
135
154
return d .get (attr )
136
-
155
+
156
+ def setCutoffDisplayPointSizeAttribute_value_ (self , attr , value ):
157
+ self ._cutoffDisplayPointSizes [attr ] = value
158
+ self .setNeedsDisplay_ (True )
159
+
160
+ def getCutoffDisplayPointSizeAttribute_ (self , attr ):
161
+ return self ._cutoffDisplayPointSizes .get (attr , None )
162
+
137
163
# ----------------
138
164
# Frame Management
139
165
# ----------------
@@ -319,7 +345,7 @@ def drawFamilyBlues(self, glyph, layerName, rect):
319
345
320
346
@python_method
321
347
def drawVerticalMetrics (self , glyph , layerName , rect ):
322
- drawText = self .getDrawingAttribute_layerName_ ("showFontVerticalMetricsTitles" , layerName ) and self ._impliedPointSize > 150
348
+ drawText = self .getDrawingAttribute_layerName_ ("showFontVerticalMetricsTitles" , layerName ) and self ._impliedPointSize > self . _cutoffDisplayPointSizes [ "showFontVerticalMetrics" ]
323
349
drawing .drawFontVerticalMetrics (glyph , self ._inverseScale , rect , drawText = drawText , backgroundColor = self ._backgroundColor , flipped = True )
324
350
325
351
@python_method
@@ -333,22 +359,29 @@ def drawFillAndStroke(self, glyph, layerName, rect):
333
359
fillColor = None
334
360
if not self ._showLayers :
335
361
fillColor = self ._glyphColor
336
- drawing .drawGlyphFillAndStroke (glyph , self ._inverseScale , rect , drawFill = showFill , drawStroke = showStroke , contourFillColor = fillColor , componentFillColor = fillColor , backgroundColor = self ._backgroundColor )
362
+ strokeColor = self ._strokeColor
363
+ drawing .drawGlyphFillAndStroke (glyph , self ._inverseScale , rect , drawFill = showFill , drawStroke = showStroke , contourFillColor = fillColor , contourStrokeColor = strokeColor , componentFillColor = fillColor , backgroundColor = self ._backgroundColor )
337
364
338
365
@python_method
339
366
def drawPoints (self , glyph , layerName , rect ):
340
- drawStartPoint = self .getDrawingAttribute_layerName_ ("showGlyphStartPoints" , layerName ) and self ._impliedPointSize > 175
341
- drawOnCurves = self .getDrawingAttribute_layerName_ ("showGlyphOnCurvePoints" , layerName ) and self ._impliedPointSize > 175
342
- drawOffCurves = self .getDrawingAttribute_layerName_ ("showGlyphOffCurvePoints" , layerName ) and self ._impliedPointSize > 175
343
- drawCoordinates = self .getDrawingAttribute_layerName_ ("showGlyphPointCoordinates" , layerName ) and self ._impliedPointSize > 250
367
+ drawStartPoint = self .getDrawingAttribute_layerName_ ("showGlyphStartPoints" , layerName ) and self ._impliedPointSize > self ._cutoffDisplayPointSizes ["showGlyphStartPoints" ]
368
+ drawOnCurves = self .getDrawingAttribute_layerName_ ("showGlyphOnCurvePoints" , layerName ) and self ._impliedPointSize > self ._cutoffDisplayPointSizes ["showGlyphOnCurvePoints" ]
369
+ drawOffCurves = self .getDrawingAttribute_layerName_ ("showGlyphOffCurvePoints" , layerName ) and self ._impliedPointSize > self ._cutoffDisplayPointSizes ["showGlyphOffCurvePoints" ]
370
+ drawCoordinates = self .getDrawingAttribute_layerName_ ("showGlyphPointCoordinates" , layerName ) and self ._impliedPointSize > self ._cutoffDisplayPointSizes ["showGlyphPointCoordinates" ]
371
+ pointColor = None
372
+ if not self ._showLayers :
373
+ pointColor = self ._pointColor
344
374
drawing .drawGlyphPoints (glyph , self ._inverseScale , rect ,
345
375
drawStartPoint = drawStartPoint , drawOnCurves = drawOnCurves , drawOffCurves = drawOffCurves , drawCoordinates = drawCoordinates ,
346
- backgroundColor = self ._backgroundColor , flipped = True )
376
+ color = pointColor , backgroundColor = self ._backgroundColor , flipped = True )
347
377
348
378
@python_method
349
379
def drawAnchors (self , glyph , layerName , rect ):
350
- drawText = self ._impliedPointSize > 50
351
- drawing .drawGlyphAnchors (glyph , self ._inverseScale , rect , drawText = drawText , backgroundColor = self ._backgroundColor , flipped = True )
380
+ drawText = self ._impliedPointSize > self ._cutoffDisplayPointSizes ["showGlyphAnchors" ]
381
+ color = None
382
+ if not self ._showLayers :
383
+ color = self ._glyphColor
384
+ drawing .drawGlyphAnchors (glyph , self ._inverseScale , rect , drawText = drawText , color = color , backgroundColor = self ._backgroundColor , flipped = True )
352
385
353
386
@python_method
354
387
def drawGlyphForeground (self , glyph , rect , alternate = False ):
0 commit comments