Commits

Anonymous committed 72a86ea

SysFont style fix

  • Participants
  • Parent commits 01a108b

Comments (0)

Files changed (4)

 # BREAK = change breaks existing code
 # BUG	= fixed a bug that was (or could have been) crashing
 
+July 17, 2004
+    SysFont extra styles being applied incorrect
+
 July 16, 2004
     mixer.set_num_channels() no longer crashes [BUG]
     mixer.music.get_pos() properly tracks when paused

File lib/sysfont.py

 
 #the exported functions
 
-def SysFont(name, size, bold=0, italic=0):
-    """pygame.font.SysFont(name, size, bold=0, italic=0) -> Font
+def SysFont(name, size, bold=False, italic=False):
+    """pygame.font.SysFont(name, size, bold=False, italic=False) -> Font
        create a pygame Font from system font resources
 
        This will search the system fonts for the given font
     if not Sysfonts:
         initsysfonts()
     
+    gotbold = gotitalic = False
     fontname = None
     if name:
         allnames = name
         for name in allnames.split(','):
-            origbold = bold
-            origitalic = italic
             name = _simplename(name)
             styles = Sysfonts.get(name)
             if not styles:
                 styles = Sysalias.get(name)
             if styles:
+                print "STYLES", styles
                 while not fontname:
+                    plainname = styles.get((False, False))
                     fontname = styles.get((bold, italic))
-                    if italic:
-                        italic = 0
-                    elif bold:
-                        bold = 0
+                    if plainname != fontname:
+                        gotbold = bold
+                        gotitalic = italic
                     elif not fontname:
-                        fontname = styles.values()[0]
+                        fontname = plainname
             if fontname: break
 
     font = pygame.font.Font(fontname, size)
-    if name:
-        if origbold and not bold:
-            font.set_bold(1)
-        if origitalic and not italic:
-            font.set_italic(1)
-    else:
-        if bold:
-            font.set_bold(1)
-        elif italic:
-            font.set_italic(1)
+    if bold and not gotbold:
+        font.set_bold(1)
+    if italic and not gotitalic:
+        font.set_italic(1)
 
     return font
 
 
 
 <p><big><b><u>Todo / Ideas</u></b></big> (feel free to submit)<br><ul>
-<li>unify more types/classes for python 2.2</li>
 <li>transform.skew() function</li>
 <li>transform.scroll() function</li>
 <li>image filtering (colors,blurs,etc)</li>
 <li>draw with transparancy</li>
 <li>draw large sets of primitives with a single call</li>
 <li>drawing offsets, perhaps as subsurfaces</li>
+<li>new scale2x, scale3x, and scale4x from hiend3d</li>
+<li>switch Numeric to numarray (see docs on how to do both)</li>
+<li>audio resampling</li>
 </ul></p><br>
 
 
      Numeric package for its multidimensional numeric arrays.
 
    Todo / Ideas (feel free to submit)
-     * unify more types/classes for python 2.2
      * transform.skew() function
      * transform.scroll() function
      * image filtering (colors,blurs,etc)
      * draw with transparancy
      * draw large sets of primitives with a single call
      * drawing offsets, perhaps as subsurfaces
+     * new scale2x, scale3x, and scale4x from hiend3d
+     * switch Numeric to numarray (see docs on how to do both)
+     * audio resampling
 
    License