X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9751f1a83023797c9068cef94d9bb6409b76058a..8096c4256b5cba930b07ad7d36caaa390d343c83:/wxPython/wx/lib/fancytext.py

diff --git a/wxPython/wx/lib/fancytext.py b/wxPython/wx/lib/fancytext.py
index 16e4a5e8b3..df7772e94b 100644
--- a/wxPython/wx/lib/fancytext.py
+++ b/wxPython/wx/lib/fancytext.py
@@ -350,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)