@@ -67,8 +67,7 @@ def write(self, msg):
67
67
print ("Stderr: %s\n \r " % msg )
68
68
69
69
70
- # the True dots per inch on the screen; should be display dependent
71
- # see
70
+ # the True dots per inch on the screen; should be display dependent; see
72
71
# http://groups.google.com/groups?q=screen+dpi+x11&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=7077.26e81ad5%40swift.cs.tcd.ie&rnum=5
73
72
# for some info about screen dpi
74
73
PIXELS_PER_INCH = 75
@@ -342,38 +341,19 @@ def get_gc(self):
342
341
return self .gc
343
342
344
343
def get_wx_font (self , s , prop ):
345
- """
346
- Return a wx font. Cache instances in a font dictionary for
347
- efficiency
348
- """
344
+ """Return a wx font. Cache font instances for efficiency."""
349
345
DEBUG_MSG ("get_wx_font()" , 1 , self )
350
-
351
346
key = hash (prop )
352
- fontprop = prop
353
- fontname = fontprop .get_name ()
354
-
355
347
font = self .fontd .get (key )
356
348
if font is not None :
357
349
return font
358
-
359
- # Allow use of platform independent and dependent font names
360
- wxFontname = self .fontnames .get (fontname , wx .ROMAN )
361
- wxFacename = '' # Empty => wxPython chooses based on wx_fontname
362
-
363
350
# Font colour is determined by the active wx.Pen
364
351
# TODO: It may be wise to cache font information
365
- size = self .points_to_pixels (fontprop .get_size_in_points ())
366
-
367
- font = wx .Font (int (size + 0.5 ), # Size
368
- wxFontname , # 'Generic' name
369
- self .fontangles [fontprop .get_style ()], # Angle
370
- self .fontweights [fontprop .get_weight ()], # Weight
371
- False , # Underline
372
- wxFacename ) # Platform font name
373
-
374
- # cache the font and gc and return it
375
- self .fontd [key ] = font
376
-
352
+ self .fontd [key ] = font = wx .Font ( # Cache the font and gc.
353
+ pointSize = self .points_to_pixels (prop .get_size_in_points ()),
354
+ family = self .fontnames .get (prop .get_name (), wx .ROMAN ),
355
+ style = self .fontangles [prop .get_style ()],
356
+ weight = self .fontweights [prop .get_weight ()])
377
357
return font
378
358
379
359
def points_to_pixels (self , points ):
0 commit comments