From: <mat...@us...> - 2009-07-15 04:25:30
|
Author: matt_harrison Date: 2009-07-15 06:25:14 +0200 (Wed, 15 Jul 2009) New Revision: 6023 Modified: trunk/sandbox/rst2odp/bin/rst2odp trunk/sandbox/rst2odp/odplib/preso.py Log: add --font command line to rst2odp for changing default font of Arial Modified: trunk/sandbox/rst2odp/bin/rst2odp =================================================================== --- trunk/sandbox/rst2odp/bin/rst2odp 2009-07-14 20:34:49 UTC (rev 6022) +++ trunk/sandbox/rst2odp/bin/rst2odp 2009-07-15 04:25:14 UTC (rev 6023) @@ -100,6 +100,10 @@ ['--mono-font'], {'action': 'store', 'dest': 'mono_font'}), + ('Specify a normal font to use ("Arial" default)', + ['--font'], + {'action': 'store', + 'dest': 'font'}), ('Specify pages to export (2,3,9-10)', ['--pages-to-output'], {'action': 'store', @@ -129,6 +133,9 @@ if self.settings.mono_font: preso.MONO_FONT = self.settings.mono_font + + if self.settings.font: + preso.NORMAL_FONT = self.settings.font self.in_node = {} # map of tagname to True if we are in/under this self._reset() Modified: trunk/sandbox/rst2odp/odplib/preso.py =================================================================== --- trunk/sandbox/rst2odp/odplib/preso.py 2009-07-14 20:34:49 UTC (rev 6022) +++ trunk/sandbox/rst2odp/odplib/preso.py 2009-07-15 04:25:14 UTC (rev 6023) @@ -60,6 +60,7 @@ DATA_DIR = os.path.join(os.path.dirname(__file__), 'data') MONO_FONT = 'Courier New' # I like 'Envy Code R' +NORMAL_FONT = 'Arial' SLIDE_WIDTH = 30 # cm SLIDE_HEIGHT = 21 @@ -271,7 +272,11 @@ def styles_xml(self): filename = os.path.join(DATA_DIR, 'styles.xml') - return open(filename).read() + data = open(filename).read() + if NORMAL_FONT != 'Arial': + data = data.replace('fo:font-family="Arial"', + 'fo:font-family="%s"' %NORMAL_FONT) + return data def to_xml(self): for i, slide in enumerate(self.slides): |