View Single Post
Old 08-04-2007, 12:42 PM   #35
swr2408018
Enthusiast
swr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enough
 
Posts: 35
Karma: 501
Join Date: Jul 2007
Device: PRS-500
SmallCap text helper class for pylrs

If you want to reproduce "SmallCaps" support, e.g., SMALLCAPS, here's a class you can add to a project.

I threw this together with pretty limited understanding of python, but it's working well for me in an ebook of a Schiller play where all the names of the parts are in smallcaps. Let me know if I've done anything crazy here?

Thanks!

Steve

class SmallCap(Span):
tagname = "SmallCap"
def __init__(self, text=None):
Span.__init__(self,"")
SmallCap.append(self,text)
def append(self,content):
for i in range(len(content)+1):
if content[i-1:i].islower():
Span.append(self,Span(content[i-1:i].upper(),fontsize=70))
else:
Span.append(self,Span(content[i-1:i],fontsize=100))
swr2408018 is offline   Reply With Quote