]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/lib/fancytext.py
GetNumberOfLines on GTK doesn't count wrapped lines again...
[wxWidgets.git] / wxPython / wx / lib / fancytext.py
index c07d6f04612bba55f05b2bef24349e545f0cd9dc..df7772e94b0697c77f2d0eac29f5c4dedde0bbbb 100644 (file)
@@ -201,18 +201,19 @@ class Renderer:
 
     def getCurrentFont(self):
         font = self.fonts[-1]
-        return wx.TheFontList.FindOrCreateFont(font.get("size", self.defaultSize),
-                             font.get("family", self.defaultFamily),
-                             font.get("style", self.defaultStyle),
-                             font.get("weight", self.defaultWeight),
-                             encoding = font.get("encoding", self.defaultEncoding))
+        return wx.Font(font.get("size", self.defaultSize),
+                       font.get("family", self.defaultFamily),
+                       font.get("style", self.defaultStyle),
+                       font.get("weight",self.defaultWeight),
+                       False, "",
+                       font.get("encoding", self.defaultEncoding))
 
     def getCurrentColor(self):
         font = self.fonts[-1]
         return wx.TheColourDatabase.FindColour(font.get("color", self.defaultColor))
         
     def getCurrentPen(self):
-        return wx.ThePenList.FindOrCreatePen(self.getCurrentColor(), 1, wx.SOLID)
+        return wx.Pen(self.getCurrentColor(), 1, wx.SOLID)
         
     def renderCharacterData(self, data, x, y):
         raise NotImplementedError()
@@ -349,6 +350,9 @@ def GetFullExtent(str, dc=None, enclose=True):
 def RenderToBitmap(str, background=None, enclose=1):
     "Return str rendered on a minumum size bitmap"
     dc = wx.MemoryDC()
+    # Chicken and egg problem, we need a bitmap in the DC in order to
+    # measure how big the bitmap should be...
+    dc.SelectObject(wx.EmptyBitmap(1,1))
     width, height, dy = GetFullExtent(str, dc, enclose)
     bmp = wx.EmptyBitmap(width, height)
     dc.SelectObject(bmp)
@@ -401,7 +405,7 @@ renderToDC = RenderToDC
 # Test Driver
 
 def test():
-    testText = 
+    testText = \
 """<font weight="bold" size="16">FancyText</font> -- <font style="italic" size="16">methods for rendering XML specified text</font>
 <font family="swiss" size="12">
 This module exports four main methods::