@@ -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
@@ -342,38 +341,19 @@ def get_gc(self):
342341 return self .gc
343342
344343 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."""
349345 _log .debug ("%s - get_wx_font()" , type (self ))
350-
351346 key = hash (prop )
352- fontprop = prop
353- fontname = fontprop .get_name ()
354-
355347 font = self .fontd .get (key )
356348 if font is not None :
357349 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-
363350 # Font colour is determined by the active wx.Pen
364351 # 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 ()])
377357 return font
378358
379359 def points_to_pixels (self , points ):
0 commit comments