[GRASS-SVN] r48220 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Sep 9 05:35:17 EDT 2011


Author: annakrat
Date: 2011-09-09 02:35:17 -0700 (Fri, 09 Sep 2011)
New Revision: 48220

Modified:
   grass/trunk/gui/wxpython/gui_modules/psmap.py
Log:
wx.psmap: fix creating font for rendering text in draft mode

Modified: grass/trunk/gui/wxpython/gui_modules/psmap.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/psmap.py	2011-09-08 21:58:48 UTC (rev 48219)
+++ grass/trunk/gui/wxpython/gui_modules/psmap.py	2011-09-09 09:35:17 UTC (rev 48220)
@@ -682,8 +682,8 @@
         fontface = textDict['font'].split('-')[0]
         try:
             fontstyle = textDict['font'].split('-')[1]
-        except:
-            fontstyle = 'normal'
+        except IndexError:
+            fontstyle = ''
         
         if fontface == "Times":
             family = wx.FONTFAMILY_ROMAN
@@ -698,26 +698,24 @@
             family = wx.FONTFAMILY_DEFAULT
             face = ''
             
-        if fontstyle == 'normal':
-            style = wx.FONTSTYLE_NORMAL
-            weight = wx.FONTWEIGHT_NORMAL
+        style = wx.FONTSTYLE_NORMAL
+        weight = wx.FONTWEIGHT_NORMAL
             
-        if 'oblique' in fontstyle:
+        if 'Oblique' in fontstyle:
             style =  wx.FONTSTYLE_SLANT
             
-        if 'italic' in fontstyle:
+        if 'Italic' in fontstyle:
             style =  wx.FONTSTYLE_ITALIC
             
-        if 'bold' in fontstyle:
+        if 'Bold' in fontstyle:
             weight = wx.FONTWEIGHT_BOLD
-        else:
-            weight = wx.FONTWEIGHT_NORMAL
         
         try:
-            fn = wx.Font(pointSize=fontsize, family=wx.FONTFAMILY_DEFAULT, 
-                         style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL)
+            fn = wx.Font(pointSize = fontsize, family = family, style = style,
+                         weight = weight, face = face)
         except:
-            fn = wx.Font(pointSize=10, family=family, style=style, weight=weight, face=face)
+            fn = wx.Font(pointSize = fontsize, family = wx.FONTFAMILY_DEFAULT, 
+                         style = wx.FONTSTYLE_NORMAL, weight = wx.FONTWEIGHT_NORMAL)
 
         return fn
        



More information about the grass-commit mailing list