summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pygments/formatters/rtf.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/pygments/formatters/rtf.py b/pygments/formatters/rtf.py
index 59d97742..ce795bb5 100644
--- a/pygments/formatters/rtf.py
+++ b/pygments/formatters/rtf.py
@@ -10,6 +10,7 @@
"""
from pygments.formatter import Formatter
+from pygments.util import get_int_opt
__all__ = ['RtfFormatter']
@@ -49,9 +50,14 @@ class RtfFormatter(Formatter):
specification claims that ``\fmodern`` are "Fixed-pitch serif
and sans serif fonts". Hope every RTF implementation thinks
the same about modern...
+
+ ``fontsize``
+ Size of the font used. Size is specified in half points. The
+ default is 24 half-points, giving a size 12 font.
"""
Formatter.__init__(self, **options)
self.fontface = options.get('fontface') or ''
+ self.fontsize = get_int_opt(options, 'fontsize', 0)
def _escape(self, text):
return text.replace('\\', '\\\\') \
@@ -106,6 +112,8 @@ class RtfFormatter(Formatter):
))
offset += 1
outfile.write(r'}\f0')
+ if self.fontsize:
+ outfile.write(r'\fs%d' % (self.fontsize))
# highlight stream
for ttype, value in tokensource: