@@ -68,8 +68,7 @@ def write(self, msg):
6868 print ("Stderr: %s\n \r " % msg )
6969
7070
71- # the True dots per inch on the screen; should be display dependent
72- # see
71+ # the True dots per inch on the screen; should be display dependent; see
7372# 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
7473# for some info about screen dpi
7574PIXELS_PER_INCH = 75
@@ -343,38 +342,19 @@ def get_gc(self):
343342 return self .gc
344343
345344 def get_wx_font (self , s , prop ):
346- """
347- Return a wx font. Cache instances in a font dictionary for
348- efficiency
349- """
345+ """Return a wx font. Cache font instances for efficiency."""
350346 _log .debug ("%s - get_wx_font()" , type (self ))
351-
352347 key = hash (prop )
353- fontprop = prop
354- fontname = fontprop .get_name ()
355-
356348 font = self .fontd .get (key )
357349 if font is not None :
358350 return font
359-
360- # Allow use of platform independent and dependent font names
361- wxFontname = self .fontnames .get (fontname , wx .ROMAN )
362- wxFacename = '' # Empty => wxPython chooses based on wx_fontname
363-
364351 # Font colour is determined by the active wx.Pen
365352 # TODO: It may be wise to cache font information
366- size = self .points_to_pixels (fontprop .get_size_in_points ())
367-
368- font = wx .Font (int (size + 0.5 ), # Size
369- wxFontname , # 'Generic' name
370- self .fontangles [fontprop .get_style ()], # Angle
371- self .fontweights [fontprop .get_weight ()], # Weight
372- False , # Underline
373- wxFacename ) # Platform font name
374-
375- # cache the font and gc and return it
376- self .fontd [key ] = font
377-
353+ self .fontd [key ] = font = wx .Font ( # Cache the font and gc.
354+ pointSize = self .points_to_pixels (prop .get_size_in_points ()),
355+ family = self .fontnames .get (prop .get_name (), wx .ROMAN ),
356+ style = self .fontangles [prop .get_style ()],
357+ weight = self .fontweights [prop .get_weight ()])
378358 return font
379359
380360 def points_to_pixels (self , points ):
0 commit comments