Viewer.py
changeset 156 2a2e974302fe
parent 155 b695f7459ef6
child 157 e4e8bc2e3e1a
--- a/Viewer.py	Fri Jan 25 17:30:49 2008 +0100
+++ b/Viewer.py	Mon Jan 28 10:31:29 2008 +0100
@@ -299,6 +299,17 @@
         
         self.SetDropTarget(ViewerDropTarget(self))
         
+        dc = wx.ClientDC(self)
+        fontsize = 10
+        self.Font = wx.Font(fontsize, wx.SWISS, wx.NORMAL, wx.NORMAL)
+        dc.SetFont(self.Font)
+        width, height = dc.GetTextExtent("A")
+        while height > 17:
+            fontsize -= 1
+            self.Font = wx.Font(fontsize, wx.SWISS, wx.NORMAL, wx.NORMAL)
+            dc.SetFont(self.Font)
+            width, height = dc.GetTextExtent("A")
+        
         # Link Viewer event to corresponding methods
         self.Bind(wx.EVT_PAINT, self.OnPaint)
         self.Bind(wx.EVT_LEFT_DOWN, self.OnViewerLeftDown)
@@ -342,10 +353,7 @@
             dc = wx.BufferedPaintDC(self)
         else:
             dc = wx.ClientDC(self)
-        if wx.Platform == '__WXMSW__':
-            dc.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL))
-        else:
-            dc.SetFont(wx.NORMAL_FONT)
+        dc.SetFont(self.Font)
         if wx.VERSION >= (2, 6, 0):
             self.DoPrepareDC(dc)
         else: