From 23931281d0876f884c20e0bbd973160259ebc243 Mon Sep 17 00:00:00 2001 From: Cas Cremers Date: Sat, 19 May 2007 15:19:02 +0200 Subject: [PATCH] - Font problems seem to be partially fixed on windows. Note that the font is not found, so rendering is ugly, but at least the text does not flow over the boxes anymore. --- gui/Gui/Scytherthread.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/gui/Gui/Scytherthread.py b/gui/Gui/Scytherthread.py index f147353..48879e0 100644 --- a/gui/Gui/Scytherthread.py +++ b/gui/Gui/Scytherthread.py @@ -158,12 +158,15 @@ class AttackThread(threading.Thread): return graphLine("%s [%s]" % (edge,atxt)) - # Precompute font name - # Set a font with sans - # We only retrieve the name, so the size '9' here is - # irrelevant. - font = wx.Font(9,wx.SWISS,wx.NORMAL,wx.NORMAL) - self.fontname = font.GetFaceName() + if sys.platform.startswith("darwin"): + self.fontname = "Helvetica" + elif sys.platform.startswith("win"): + self.fontname = "Courier" + else: + font = wx.Font(9,wx.SWISS,wx.NORMAL,wx.NORMAL) + self.fontname = font.GetFaceName() + + # write all graph lines but add layout modifiers for l in txt.splitlines(): @@ -179,8 +182,9 @@ class AttackThread(threading.Thread): #graphLine("mindist=0.1") # Set fontname - fontstring = "fontname=%s" % (self.fontname) - setAttr(fontstring,EDGE) + if self.fontname: + fontstring = "fontname=%s" % (self.fontname) + setAttr(fontstring) # Stupid Mac <> Graphviz bug fix if (sys.platform.startswith("mac")) or (sys.platform.startswith("darwin")):