# HG changeset patch # User lbessard # Date 1201512689 -3600 # Node ID 2a2e974302fe3e6bc1d952cb65b70644a835de82 # Parent b695f7459ef63462ec9197558008bc75552625fd Adding support for Viewer font diff -r b695f7459ef6 -r 2a2e974302fe Viewer.py --- 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: