1
#see license.txt for license details
2
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/widgets/flags.py
3
# Flag Widgets - a collection of flags as widgets
4
# author: John Precedo (johnp@reportlab.com)
5
"""This file is a collection of flag graphics as widgets.
7
All flags are represented at the ratio of 1:2, even where the official ratio for the flag is something else
8
(such as 3:5 for the German national flag). The only exceptions are for where this would look _very_ wrong,
9
such as the Danish flag whose (ratio is 28:37), or the Swiss flag (which is square).
11
Unless otherwise stated, these flags are all the 'national flags' of the countries, rather than their
12
state flags, naval flags, ensigns or any other variants. (National flags are the flag flown by civilians
13
of a country and the ones usually used to represent a country abroad. State flags are the variants used by
14
the government and by diplomatic missions overseas).
16
To check on how close these are to the 'official' representations of flags, check the World Flag Database at
17
http://www.flags.ndirect.co.uk/
19
The flags this file contains are:
22
United Kingdom, Austria, Belgium, Denmark, Finland, France, Germany, Greece, Ireland, Italy, Luxembourg,
23
Holland (The Netherlands), Spain, Sweden
26
USA, Czech Republic, European Union, Switzerland, Turkey, Brazil
28
(Brazilian flag contributed by Publio da Costa Melo [publio@planetarium.com.br]).
30
__version__=''' $Id$ '''
32
from reportlab.lib import colors
33
from reportlab.lib.validators import *
34
from reportlab.lib.attrmap import *
35
from reportlab.graphics.shapes import Line, Rect, Polygon, Drawing, Group, String, Circle, Wedge
36
from reportlab.graphics.widgetbase import Widget
37
from reportlab.graphics import renderPDF
38
from signsandsymbols import _Symbol
40
from math import sin, cos, pi
76
"""This draws a 5-pointed star.
79
'x', 'y', 'size', 'fillColor', 'strokeColor'
82
_attrMap = AttrMap(BASE=_Symbol,
83
angle = AttrMapValue(isNumber, desc='angle in degrees'),
88
_Symbol.__init__(self)
90
self.fillColor = colors.yellow
91
self.strokeColor = None
101
D.add(String(et.x+(et.size/2.0),(et.y-(1.2*labelFontSize)),
102
et.__class__.__name__, fillColor=colors.black, textAnchor='middle',
103
fontSize=labelFontSize))
107
s = float(self.size) #abbreviate as we will use this a lot
110
# new algorithm from markers.StarFive
111
R = float(self.size)/2
112
r = R*sin(18*(pi/180.0))/cos(36*(pi/180.0))
117
theta = angle*(pi/180.0)
118
P.append(radius*cos(theta))
119
P.append(radius*sin(theta))
123
fillColor = self.fillColor,
124
strokeColor = self.strokeColor,
127
g.shift(self.x+self.dx,self.y+self.dy)
133
"""This is a generic flag class that all the flags in this file use as a basis.
135
This class basically provides edges and a tidy-up routine to hide any bits of
136
line that overlap the 'outside' of the flag
139
'x', 'y', 'size', 'fillColor'
142
_attrMap = AttrMap(BASE=_Symbol,
143
fillColor = AttrMapValue(isColor, desc='Background color'),
144
border = AttrMapValue(isBoolean, 'Whether a background is drawn'),
145
kind = AttrMapValue(validFlag, desc='Which flag'),
150
def __init__(self,**kw):
151
_Symbol.__init__(self)
154
self.fillColor = colors.white
156
self.setProperties(kw)
158
def availableFlagNames(self):
159
'''return a list of the things we can display'''
160
return filter(lambda x: x is not None, self._attrMap['kind'].validate._enum)
162
def _Flag_None(self):
163
s = _size # abbreviate as we will use this a lot
165
g.add(Rect(0, 0, s*2, s, fillColor = colors.purple, strokeColor = colors.black, strokeWidth=0))
168
def _borderDraw(self,f):
169
s = self.size # abbreviate as we will use this a lot
172
x, y, sW = self.x+self.dx, self.y+self.dy, self.strokeWidth/2.
173
g.insert(0,Rect(-sW, -sW, width=getattr(self,'_width',2*s)+3*sW, height=getattr(self,'_height',s)+2*sW,
174
fillColor = None, strokeColor = self.strokeColor, strokeWidth=sW*2))
176
g.scale(s/_size, s/_size)
180
kind = self.kind or 'None'
181
f = self._cache.get(kind)
183
f = getattr(self,'_Flag_'+kind)()
184
self._cache[kind] = f._explode()
185
return self._borderDraw(f)
188
return copy.copy(self)
191
D = Drawing(200, 100)
192
name = self.availableFlagNames()
194
name = name[int(time.time()) % len(name)]
201
D.add(String(fx.x+(fx.size/2),(fx.y-(1.2*labelFontSize)),
202
name, fillColor=colors.black, textAnchor='middle',
203
fontSize=labelFontSize))
204
labelFontSize = int(fx.size/4)
205
D.add(String(fx.x+(fx.size),(fx.y+((fx.size/2))),
206
"SAMPLE", fillColor=colors.gold, textAnchor='middle',
207
fontSize=labelFontSize, fontName="Helvetica-Bold"))
214
g.add(Rect(0, 0, w, s, fillColor = colors.navy, strokeColor = colors.black, strokeWidth=0))
215
g.add(Polygon([0,0, s*.225,0, w,s*(1-.1125), w,s, w-s*.225,s, 0, s*.1125], fillColor = colors.mintcream, strokeColor=None, strokeWidth=0))
216
g.add(Polygon([0,s*(1-.1125), 0, s, s*.225,s, w, s*.1125, w,0, w-s*.225,0], fillColor = colors.mintcream, strokeColor=None, strokeWidth=0))
217
g.add(Polygon([0, s-(s/15), (s-((s/10)*4)), (s*0.65), (s-(s/10)*3), (s*0.65), 0, s], fillColor = colors.red, strokeColor = None, strokeWidth=0))
218
g.add(Polygon([0, 0, (s-((s/10)*3)), (s*0.35), (s-((s/10)*2)), (s*0.35), (s/10), 0], fillColor = colors.red, strokeColor = None, strokeWidth=0))
219
g.add(Polygon([w, s, (s+((s/10)*3)), (s*0.65), (s+((s/10)*2)), (s*0.65), w-(s/10), s], fillColor = colors.red, strokeColor = None, strokeWidth=0))
220
g.add(Polygon([w, (s/15), (s+((s/10)*4)), (s*0.35), (s+((s/10)*3)), (s*0.35), w, 0], fillColor = colors.red, strokeColor = None, strokeWidth=0))
221
g.add(Rect(((s*0.42)*2), 0, width=(0.16*s)*2, height=s, fillColor = colors.mintcream, strokeColor = None, strokeWidth=0))
222
g.add(Rect(0, (s*0.35), width=w, height=s*0.3, fillColor = colors.mintcream, strokeColor = None, strokeWidth=0))
223
g.add(Rect(((s*0.45)*2), 0, width=(0.1*s)*2, height=s, fillColor = colors.red, strokeColor = None, strokeWidth=0))
224
g.add(Rect(0, (s*0.4), width=w, height=s*0.2, fillColor = colors.red, strokeColor = None, strokeWidth=0))
228
s = _size # abbreviate as we will use this a lot
231
box = Rect(0, 0, s*2, s, fillColor = colors.mintcream, strokeColor = colors.black, strokeWidth=0)
234
for stripecounter in range (13,0, -1):
235
stripeheight = s/13.0
236
if not (stripecounter%2 == 0):
237
stripecolor = colors.red
239
stripecolor = colors.mintcream
240
redorwhiteline = Rect(0, (s-(stripeheight*stripecounter)), width=s*2, height=stripeheight,
241
fillColor = stripecolor, strokeColor = None, strokeWidth=20)
242
g.add(redorwhiteline)
244
bluebox = Rect(0, (s-(stripeheight*7)), width=0.8*s, height=stripeheight*7,
245
fillColor = colors.darkblue, strokeColor = None, strokeWidth=0)
252
for starxcounter in range(5):
253
for starycounter in range(4):
256
ls.x = 0-s/22+lss/2+s7+starxcounter*s7
257
ls.fillColor = colors.mintcream
258
ls.y = s-(starycounter+1)*s9+lss2
261
for starxcounter in range(6):
262
for starycounter in range(5):
265
ls.x = 0-(s/22)+lss/2+s/14+starxcounter*s7
266
ls.fillColor = colors.mintcream
267
ls.y = s-(starycounter+1)*s9+(s/18)+lss2
271
def _Flag_Afghanistan(self):
275
box = Rect(0, 0, s*2, s,
276
fillColor = colors.mintcream, strokeColor = colors.black, strokeWidth=0)
279
greenbox = Rect(0, ((s/3.0)*2.0), width=s*2.0, height=s/3.0,
280
fillColor = colors.limegreen, strokeColor = None, strokeWidth=0)
283
blackbox = Rect(0, 0, width=s*2.0, height=s/3.0,
284
fillColor = colors.black, strokeColor = None, strokeWidth=0)
288
def _Flag_Austria(self):
289
s = _size # abbreviate as we will use this a lot
292
box = Rect(0, 0, s*2, s, fillColor = colors.mintcream,
293
strokeColor = colors.black, strokeWidth=0)
297
redbox1 = Rect(0, 0, width=s*2.0, height=s/3.0,
298
fillColor = colors.red, strokeColor = None, strokeWidth=0)
301
redbox2 = Rect(0, ((s/3.0)*2.0), width=s*2.0, height=s/3.0,
302
fillColor = colors.red, strokeColor = None, strokeWidth=0)
306
def _Flag_Belgium(self):
310
box = Rect(0, 0, s*2, s,
311
fillColor = colors.black, strokeColor = colors.black, strokeWidth=0)
315
box1 = Rect(0, 0, width=(s/3.0)*2.0, height=s,
316
fillColor = colors.black, strokeColor = None, strokeWidth=0)
319
box2 = Rect(((s/3.0)*2.0), 0, width=(s/3.0)*2.0, height=s,
320
fillColor = colors.gold, strokeColor = None, strokeWidth=0)
323
box3 = Rect(((s/3.0)*4.0), 0, width=(s/3.0)*2.0, height=s,
324
fillColor = colors.red, strokeColor = None, strokeWidth=0)
328
def _Flag_China(self):
331
self._width = w = s*1.5
332
g.add(Rect(0, 0, w, s, fillColor=colors.red, strokeColor=None, strokeWidth=0))
334
def addStar(x,y,size,angle,g=g,w=s/20,x0=0,y0=s/2):
336
s.fillColor=colors.yellow
344
addStar(10,1,1,36.86989765)
345
addStar(12,3,1,8.213210702)
346
addStar(12,6,1,16.60154960)
347
addStar(10,8,1,53.13010235)
350
def _Flag_Cuba(self):
355
stripe = Rect(0, i*s/5, width=s*2, height=s/5,
356
fillColor = [colors.darkblue, colors.mintcream][i%2],
361
redwedge = Polygon(points = [ 0, 0, 4*s/5, (s/2), 0, s],
362
fillColor = colors.red, strokeColor = None, strokeWidth=0)
369
star.fillColor = colors.white
372
box = Rect(0, 0, s*2, s,
374
strokeColor = colors.black,
380
def _Flag_Denmark(self):
383
self._width = w = s*1.4
385
box = Rect(0, 0, w, s,
386
fillColor = colors.red, strokeColor = colors.black, strokeWidth=0)
389
whitebox1 = Rect(((s/5)*2), 0, width=s/6, height=s,
390
fillColor = colors.mintcream, strokeColor = None, strokeWidth=0)
393
whitebox2 = Rect(0, ((s/2)-(s/12)), width=w, height=s/6,
394
fillColor = colors.mintcream, strokeColor = None, strokeWidth=0)
398
def _Flag_Finland(self):
402
# crossbox specific bits
403
box = Rect(0, 0, s*2, s,
404
fillColor = colors.ghostwhite, strokeColor = colors.black, strokeWidth=0)
407
blueline1 = Rect((s*0.6), 0, width=0.3*s, height=s,
408
fillColor = colors.darkblue, strokeColor = None, strokeWidth=0)
411
blueline2 = Rect(0, (s*0.4), width=s*2, height=s*0.3,
412
fillColor = colors.darkblue, strokeColor = None, strokeWidth=0)
416
def _Flag_France(self):
420
box = Rect(0, 0, s*2, s, fillColor = colors.navy, strokeColor = colors.black, strokeWidth=0)
423
bluebox = Rect(0, 0, width=((s/3.0)*2.0), height=s,
424
fillColor = colors.blue, strokeColor = None, strokeWidth=0)
427
whitebox = Rect(((s/3.0)*2.0), 0, width=((s/3.0)*2.0), height=s,
428
fillColor = colors.mintcream, strokeColor = None, strokeWidth=0)
431
redbox = Rect(((s/3.0)*4.0), 0, width=((s/3.0)*2.0), height=s,
432
fillColor = colors.red,
438
def _Flag_Germany(self):
442
box = Rect(0, 0, s*2, s,
443
fillColor = colors.gold, strokeColor = colors.black, strokeWidth=0)
446
blackbox1 = Rect(0, ((s/3.0)*2.0), width=s*2.0, height=s/3.0,
447
fillColor = colors.black, strokeColor = None, strokeWidth=0)
450
redbox1 = Rect(0, (s/3.0), width=s*2.0, height=s/3.0,
451
fillColor = colors.orangered, strokeColor = None, strokeWidth=0)
455
def _Flag_Greece(self):
459
box = Rect(0, 0, s*2, s, fillColor = colors.gold,
460
strokeColor = colors.black, strokeWidth=0)
463
for stripecounter in range (9,0, -1):
465
if not (stripecounter%2 == 0):
466
stripecolor = colors.deepskyblue
468
stripecolor = colors.mintcream
470
blueorwhiteline = Rect(0, (s-(stripeheight*stripecounter)), width=s*2, height=stripeheight,
471
fillColor = stripecolor, strokeColor = None, strokeWidth=20)
472
g.add(blueorwhiteline)
474
bluebox1 = Rect(0, ((s)-stripeheight*5), width=(stripeheight*5), height=stripeheight*5,
475
fillColor = colors.deepskyblue, strokeColor = None, strokeWidth=0)
478
whiteline1 = Rect(0, ((s)-stripeheight*3), width=stripeheight*5, height=stripeheight,
479
fillColor = colors.mintcream, strokeColor = None, strokeWidth=0)
482
whiteline2 = Rect((stripeheight*2), ((s)-stripeheight*5), width=stripeheight, height=stripeheight*5,
483
fillColor = colors.mintcream, strokeColor = None, strokeWidth=0)
488
def _Flag_Ireland(self):
492
box = Rect(0, 0, s*2, s,
493
fillColor = colors.forestgreen, strokeColor = colors.black, strokeWidth=0)
496
whitebox = Rect(((s*2.0)/3.0), 0, width=(2.0*(s*2.0)/3.0), height=s,
497
fillColor = colors.mintcream, strokeColor = None, strokeWidth=0)
500
orangebox = Rect(((2.0*(s*2.0)/3.0)), 0, width=(s*2.0)/3.0, height=s,
501
fillColor = colors.darkorange, strokeColor = None, strokeWidth=0)
505
def _Flag_Italy(self):
508
g.add(Rect(0,0,s*2,s,fillColor=colors.forestgreen,strokeColor=None, strokeWidth=0))
509
g.add(Rect((2*s)/3, 0, width=(s*4)/3, height=s, fillColor = colors.mintcream, strokeColor = None, strokeWidth=0))
510
g.add(Rect((4*s)/3, 0, width=(s*2)/3, height=s, fillColor = colors.red, strokeColor = None, strokeWidth=0))
513
def _Flag_Japan(self):
516
w = self._width = s*1.5
517
g.add(Rect(0,0,w,s,fillColor=colors.mintcream,strokeColor=None, strokeWidth=0))
518
g.add(Circle(cx=w/2,cy=s/2,r=0.3*w,fillColor=colors.red,strokeColor=None, strokeWidth=0))
521
def _Flag_Luxembourg(self):
525
box = Rect(0, 0, s*2, s,
526
fillColor = colors.mintcream, strokeColor = colors.black, strokeWidth=0)
529
redbox = Rect(0, ((s/3.0)*2.0), width=s*2.0, height=s/3.0,
530
fillColor = colors.red, strokeColor = None, strokeWidth=0)
533
bluebox = Rect(0, 0, width=s*2.0, height=s/3.0,
534
fillColor = colors.dodgerblue, strokeColor = None, strokeWidth=0)
538
def _Flag_Holland(self):
542
box = Rect(0, 0, s*2, s,
543
fillColor = colors.mintcream, strokeColor = colors.black, strokeWidth=0)
546
redbox = Rect(0, ((s/3.0)*2.0), width=s*2.0, height=s/3.0,
547
fillColor = colors.red, strokeColor = None, strokeWidth=0)
550
bluebox = Rect(0, 0, width=s*2.0, height=s/3.0,
551
fillColor = colors.darkblue, strokeColor = None, strokeWidth=0)
555
def _Flag_Portugal(self):
558
def _Flag_Russia(self):
561
w = self._width = s*1.5
563
g.add(Rect(0, 0, width=w, height=t, fillColor = colors.red, strokeColor = None, strokeWidth=0))
564
g.add(Rect(0, t, width=w, height=t, fillColor = colors.blue, strokeColor = None, strokeWidth=0))
565
g.add(Rect(0, 2*t, width=w, height=t, fillColor = colors.mintcream, strokeColor = None, strokeWidth=0))
568
def _Flag_Spain(self):
571
w = self._width = s*1.5
572
g.add(Rect(0, 0, width=w, height=s, fillColor = colors.red, strokeColor = None, strokeWidth=0))
573
g.add(Rect(0, (s/4), width=w, height=s/2, fillColor = colors.yellow, strokeColor = None, strokeWidth=0))
576
def _Flag_Sweden(self):
580
box = Rect(0, 0, self._width, s,
581
fillColor = colors.dodgerblue, strokeColor = colors.black, strokeWidth=0)
584
box1 = Rect(((s/5)*2), 0, width=s/6, height=s,
585
fillColor = colors.gold, strokeColor = None, strokeWidth=0)
588
box2 = Rect(0, ((s/2)-(s/12)), width=self._width, height=s/6,
589
fillColor = colors.gold,
595
def _Flag_Norway(self):
600
box = Rect(0, 0, self._width, s,
601
fillColor = colors.red, strokeColor = colors.black, strokeWidth=0)
604
box = Rect(0, 0, self._width, s,
605
fillColor = colors.red, strokeColor = colors.black, strokeWidth=0)
608
whiteline1 = Rect(((s*0.2)*2), 0, width=s*0.2, height=s,
609
fillColor = colors.ghostwhite, strokeColor = None, strokeWidth=0)
612
whiteline2 = Rect(0, (s*0.4), width=self._width, height=s*0.2,
613
fillColor = colors.ghostwhite, strokeColor = None, strokeWidth=0)
616
blueline1 = Rect(((s*0.225)*2), 0, width=0.1*s, height=s,
617
fillColor = colors.darkblue, strokeColor = None, strokeWidth=0)
620
blueline2 = Rect(0, (s*0.45), width=self._width, height=s*0.1,
621
fillColor = colors.darkblue, strokeColor = None, strokeWidth=0)
625
def _Flag_CzechRepublic(self):
628
box = Rect(0, 0, s*2, s,
629
fillColor = colors.mintcream,
630
strokeColor = colors.black,
634
redbox = Rect(0, 0, width=s*2, height=s/2,
635
fillColor = colors.red,
640
bluewedge = Polygon(points = [ 0, 0, s, (s/2), 0, s],
641
fillColor = colors.darkblue, strokeColor = None, strokeWidth=0)
645
def _Flag_Palestine(self):
648
box = Rect(0, s/3, s*2, s/3,
649
fillColor = colors.mintcream,
654
greenbox = Rect(0, 0, width=s*2, height=s/3,
655
fillColor = colors.limegreen,
660
blackbox = Rect(0, 2*s/3, width=s*2, height=s/3,
661
fillColor = colors.black,
666
redwedge = Polygon(points = [ 0, 0, 2*s/3, (s/2), 0, s],
667
fillColor = colors.red, strokeColor = None, strokeWidth=0)
671
def _Flag_Turkey(self):
675
box = Rect(0, 0, s*2, s,
676
fillColor = colors.red,
677
strokeColor = colors.black,
681
whitecircle = Circle(cx=((s*0.35)*2), cy=s/2, r=s*0.3,
682
fillColor = colors.mintcream,
687
redcircle = Circle(cx=((s*0.39)*2), cy=s/2, r=s*0.24,
688
fillColor = colors.red,
696
ws.x = (s*0.5)*2+ws.size/2
698
ws.fillColor = colors.mintcream
699
ws.strokeColor = None
703
def _Flag_Switzerland(self):
708
g.add(Rect(0, 0, s, s, fillColor = colors.red, strokeColor = colors.black, strokeWidth=0))
709
g.add(Line((s/2), (s/5.5), (s/2), (s-(s/5.5)),
710
fillColor = colors.mintcream, strokeColor = colors.mintcream, strokeWidth=(s/5)))
711
g.add(Line((s/5.5), (s/2), (s-(s/5.5)), (s/2),
712
fillColor = colors.mintcream, strokeColor = colors.mintcream, strokeWidth=s/5))
718
w = self._width = 1.5*s
720
g.add(Rect(0, 0, w, s, fillColor = colors.darkblue, strokeColor = None, strokeWidth=0))
728
for i in range(nStars):
731
gs.x=cos(rad)*radius+centerx
732
gs.y=sin(rad)*radius+centery
734
gs.fillColor=colors.gold
738
def _Flag_Brazil(self):
739
s = _size # abbreviate as we will use this a lot
743
self._width = w = (m * 20)
745
def addStar(x,y,size, g=g, w=w, s=s, m=m):
747
st.fillColor=colors.mintcream
749
st.x = (w/2) + (x * (0.35 * m))
750
st.y = (s/2) + (y * (0.35 * m))
753
g.add(Rect(0, 0, w, s, fillColor = colors.green, strokeColor = None, strokeWidth=0))
754
g.add(Polygon(points = [ 1.7*m, (s/2), (w/2), s-(1.7*m), w-(1.7*m),(s/2),(w/2), 1.7*m],
755
fillColor = colors.yellow, strokeColor = None, strokeWidth=0))
756
g.add(Circle(cx=w/2, cy=s/2, r=3.5*m,
757
fillColor=colors.blue,strokeColor=None, strokeWidth=0))
758
g.add(Wedge((w/2)-(2*m), 0, 8.5*m, 50, 98.1, 8.5*m,
759
fillColor=colors.mintcream,strokeColor=None, strokeWidth=0))
760
g.add(Wedge((w/2), (s/2), 3.501*m, 156, 352, 3.501*m,
761
fillColor=colors.mintcream,strokeColor=None, strokeWidth=0))
762
g.add(Wedge((w/2)-(2*m), 0, 8*m, 48.1, 100, 8*m,
763
fillColor=colors.blue,strokeColor=None, strokeWidth=0))
764
g.add(Rect(0, 0, w, (s/4) + 1.7*m,
765
fillColor = colors.green, strokeColor = None, strokeWidth=0))
766
g.add(Polygon(points = [ 1.7*m,(s/2), (w/2),s/2 - 2*m, w-(1.7*m),(s/2) , (w/2),1.7*m],
767
fillColor = colors.yellow, strokeColor = None, strokeWidth=0))
768
g.add(Wedge(w/2, s/2, 3.502*m, 166, 342.1, 3.502*m,
769
fillColor=colors.blue,strokeColor=None, strokeWidth=0))
772
addStar(-8.5,1.5,0.3)
777
addStar(-3.5,-0.5,0.25)
784
addStar(-5.5,-3.2,0.25)
785
addStar(-6,-4.2,0.25)
786
addStar(-1,-2.75,0.2)
792
addStar(-8.8,-3.2,0.2)
794
addStar(-0.2,-3.2,0.14)
795
addStar(-7.2,-2,0.14)
798
sTmp = "ORDEM E PROGRESSO"
800
delta = 0.850848010347/nTmp
802
centerx = (w/2)-(2*m)
804
for i in range(nTmp):
805
rad = 2*pi - i*delta -4.60766922527
806
x=cos(rad)*radius+centerx
807
y=sin(rad)*radius+centery
812
g2 = Group(String(x, y, sTmp[i], fontName='Helvetica-Bold',
813
fontSize = z,strokeColor=None,fillColor=colors.green))
824
"""This function produces three pdf files with examples of all the signs and symbols from this file.
863
if not D: D = Drawing(450,650)
864
flag = makeFlag(name)
865
i = flags.index(name)
869
D.add(String(flag.x+(flag.size/2),(flag.y-(1.2*labelFontSize)),
870
name, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize))
872
if (i%2 and y<0) or name==flags[-1]:
873
renderPDF.drawToFile(D, 'flags%02d.pdf'%f, 'flags.py - Page #%d'%(f+1))
878
if __name__=='__main__':