4330
|
1 |
#Copyright ReportLab Europe Ltd. 2000-2017
|
2963
|
2 |
#see license.txt for license details
|
|
3 |
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/tools/pythonpoint/styles/modern.py
|
4252
|
4 |
__version__='3.3.0'
|
2963
|
5 |
# style_modern.py
|
|
6 |
__doc__="""This is an example style sheet. You can create your own, and
|
|
7 |
have them loaded by the presentation. A style sheet is just a
|
|
8 |
dictionary, where they keys are style names and the values are
|
|
9 |
ParagraphStyle objects.
|
|
10 |
|
|
11 |
You must provide a function called "getParagraphStyles()" to
|
|
12 |
return it. In future, we can put things like LineStyles,
|
|
13 |
TableCellStyles etc. in the same modules.
|
|
14 |
|
|
15 |
You might wish to have two parallel style sheets, one for colour
|
|
16 |
and one for black and white, so you can switch your presentations
|
|
17 |
easily.
|
|
18 |
|
|
19 |
A style sheet MUST define a style called 'Normal'.
|
|
20 |
"""
|
|
21 |
|
|
22 |
from reportlab.lib import styles
|
|
23 |
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY
|
|
24 |
|
|
25 |
def getParagraphStyles():
|
|
26 |
"""Returns a dictionary of styles based on Helvetica"""
|
|
27 |
stylesheet = {}
|
|
28 |
ParagraphStyle = styles.ParagraphStyle
|
|
29 |
|
|
30 |
para = ParagraphStyle('Normal', None) #the ancestor of all
|
|
31 |
para.fontName = 'Helvetica'
|
|
32 |
para.fontSize = 24
|
|
33 |
para.leading = 28
|
|
34 |
stylesheet['Normal'] = para
|
|
35 |
|
|
36 |
para = ParagraphStyle('BodyText', stylesheet['Normal'])
|
|
37 |
para.spaceBefore = 12
|
|
38 |
stylesheet['BodyText'] = para
|
|
39 |
|
|
40 |
para = ParagraphStyle('Indent', stylesheet['Normal'])
|
|
41 |
para.leftIndent = 36
|
|
42 |
para.firstLineIndent = 0
|
|
43 |
stylesheet['Indent'] = para
|
|
44 |
|
|
45 |
para = ParagraphStyle('Centered', stylesheet['Normal'])
|
|
46 |
para.alignment = TA_CENTER
|
|
47 |
stylesheet['Centered'] = para
|
|
48 |
|
|
49 |
para = ParagraphStyle('BigCentered', stylesheet['Normal'])
|
|
50 |
para.spaceBefore = 12
|
|
51 |
para.alignment = TA_CENTER
|
|
52 |
stylesheet['BigCentered'] = para
|
|
53 |
|
|
54 |
para = ParagraphStyle('Italic', stylesheet['BodyText'])
|
|
55 |
para.fontName = 'Helvetica-Oblique'
|
|
56 |
stylesheet['Italic'] = para
|
|
57 |
|
|
58 |
para = ParagraphStyle('Title', stylesheet['Normal'])
|
|
59 |
para.fontName = 'Helvetica'
|
|
60 |
para.fontSize = 48
|
|
61 |
para.Leading = 58
|
|
62 |
para.spaceAfter = 36
|
|
63 |
para.alignment = TA_CENTER
|
|
64 |
stylesheet['Title'] = para
|
|
65 |
|
|
66 |
para = ParagraphStyle('Heading1', stylesheet['Normal'])
|
|
67 |
para.fontName = 'Helvetica-Bold'
|
|
68 |
para.fontSize = 36
|
|
69 |
para.leading = 44
|
|
70 |
para.spaceAfter = 36
|
|
71 |
para.alignment = TA_CENTER
|
|
72 |
stylesheet['Heading1'] = para
|
|
73 |
|
|
74 |
para = ParagraphStyle('Heading2', stylesheet['Normal'])
|
|
75 |
para.fontName = 'Helvetica-Bold'
|
|
76 |
para.fontSize = 28
|
|
77 |
para.leading = 34
|
|
78 |
para.spaceBefore = 24
|
|
79 |
para.spaceAfter = 12
|
|
80 |
stylesheet['Heading2'] = para
|
|
81 |
|
|
82 |
para = ParagraphStyle('Heading3', stylesheet['Normal'])
|
|
83 |
para.fontName = 'Helvetica-BoldOblique'
|
|
84 |
para.spaceBefore = 24
|
|
85 |
para.spaceAfter = 12
|
|
86 |
stylesheet['Heading3'] = para
|
|
87 |
|
|
88 |
para = ParagraphStyle('Bullet', stylesheet['Normal'])
|
|
89 |
para.firstLineIndent = -18
|
|
90 |
para.leftIndent = 72
|
|
91 |
para.spaceBefore = 6
|
|
92 |
para.bulletFontName = 'Symbol'
|
|
93 |
para.bulletFontSize = 24
|
|
94 |
para.bulletIndent = 36
|
|
95 |
stylesheet['Bullet'] = para
|
|
96 |
|
|
97 |
para = ParagraphStyle('Bullet2', stylesheet['Bullet'])
|
|
98 |
para.firstLineIndent = 0
|
|
99 |
para.bulletIndent = 72
|
|
100 |
para.leftIndent = 108
|
|
101 |
stylesheet['Bullet2'] = para
|
|
102 |
|
|
103 |
|
|
104 |
para = ParagraphStyle('Definition', stylesheet['Normal'])
|
|
105 |
#use this for definition lists
|
|
106 |
para.firstLineIndent = 0
|
|
107 |
para.leftIndent = 72
|
|
108 |
para.bulletIndent = 0
|
|
109 |
para.spaceBefore = 12
|
|
110 |
para.bulletFontName = 'Helvetica-BoldOblique'
|
|
111 |
stylesheet['Definition'] = para
|
|
112 |
|
|
113 |
para = ParagraphStyle('Code', stylesheet['Normal'])
|
|
114 |
para.fontName = 'Courier'
|
|
115 |
para.fontSize = 16
|
|
116 |
para.leading = 18
|
|
117 |
para.leftIndent = 36
|
|
118 |
stylesheet['Code'] = para
|
|
119 |
|
|
120 |
return stylesheet |