Selaa lähdekoodia

wx.psmap: fix creating font for rendering text in draft mode

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48220 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 13 vuotta sitten
vanhempi
commit
1e08589842
1 muutettua tiedostoa jossa 11 lisäystä ja 13 poistoa
  1. 11 13
      gui/wxpython/gui_modules/psmap.py

+ 11 - 13
gui/wxpython/gui_modules/psmap.py

@@ -682,8 +682,8 @@ class PsMapFrame(wx.Frame):
         fontface = textDict['font'].split('-')[0]
         fontface = textDict['font'].split('-')[0]
         try:
         try:
             fontstyle = textDict['font'].split('-')[1]
             fontstyle = textDict['font'].split('-')[1]
-        except:
-            fontstyle = 'normal'
+        except IndexError:
+            fontstyle = ''
         
         
         if fontface == "Times":
         if fontface == "Times":
             family = wx.FONTFAMILY_ROMAN
             family = wx.FONTFAMILY_ROMAN
@@ -698,26 +698,24 @@ class PsMapFrame(wx.Frame):
             family = wx.FONTFAMILY_DEFAULT
             family = wx.FONTFAMILY_DEFAULT
             face = ''
             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
             style =  wx.FONTSTYLE_SLANT
             
             
-        if 'italic' in fontstyle:
+        if 'Italic' in fontstyle:
             style =  wx.FONTSTYLE_ITALIC
             style =  wx.FONTSTYLE_ITALIC
             
             
-        if 'bold' in fontstyle:
+        if 'Bold' in fontstyle:
             weight = wx.FONTWEIGHT_BOLD
             weight = wx.FONTWEIGHT_BOLD
-        else:
-            weight = wx.FONTWEIGHT_NORMAL
         
         
         try:
         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:
         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
         return fn