1 #!/usr/bin/env python
2 import chardataeffect, inkex, string
4 import random
6 class C(chardataeffect.CharDataEffect):
8 def process_chardata(self,text, line, par):
9 r = ""
10 a = 1
11 for i in range(len(text)):
12 c = text[i]
13 # bias the randomness towards inversion of the previous case:
14 if a > 0:
15 a = random.choice([-2,-1,1])
16 else:
17 a = random.choice([-1,1,2])
18 if a > 0 and c.isalpha():
19 r = r + c.upper()
20 elif a < 0 and c.isalpha():
21 r = r + c.lower()
22 else:
23 r = r + c
25 return r
27 c = C()
28 c.affect()