Family Tree Maker style ancestor report
svn: r1487
This commit is contained in:
@@ -64,7 +64,7 @@ class AbiWordDoc(TextDoc.TextDoc):
|
||||
self.filename = filename
|
||||
|
||||
self.f = open(self.filename,"w")
|
||||
self.f.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n')
|
||||
self.f.write('<?xml version="1.0"?>\n')
|
||||
self.f.write('<!DOCTYPE abiword PUBLIC "-//ABISOURCE//DTD AWML')
|
||||
self.f.write('1.0 Strict//EN" "http://www.abisource.com/awml.dtd">\n')
|
||||
self.f.write('<abiword xmlns:awml="http://www.abisource.com/awml.dtd" ')
|
||||
@@ -132,6 +132,13 @@ class AbiWordDoc(TextDoc.TextDoc):
|
||||
self.f.write('" props="width:%.3fin; ' % act_width)
|
||||
self.f.write('height:%.3fin"/>' % act_height)
|
||||
|
||||
def start_superscript(self):
|
||||
fsize = self.my_para.get_font().get_size()
|
||||
self.text = self.text + '<c props="text-position:superscript">'
|
||||
|
||||
def end_superscript(self):
|
||||
self.text = self.text + '</c>'
|
||||
|
||||
def start_paragraph(self,style_name,leader=None):
|
||||
if self.in_table:
|
||||
self.start_paragraph_intable(style_name,leader)
|
||||
@@ -142,6 +149,8 @@ class AbiWordDoc(TextDoc.TextDoc):
|
||||
style = self.style_list[style_name]
|
||||
self.current_style = style
|
||||
self.f.write('<p props="')
|
||||
self.f.write('margin-top:%.4fin; ' % (float(style.get_padding())/2.54))
|
||||
self.f.write('margin-bottom:%.4fin; ' % (float(style.get_padding())/2.54))
|
||||
if style.get_alignment() == TextDoc.PARA_ALIGN_RIGHT:
|
||||
self.f.write('text-align:right;')
|
||||
elif style.get_alignment() == TextDoc.PARA_ALIGN_LEFT:
|
||||
@@ -216,9 +225,11 @@ class AbiWordDoc(TextDoc.TextDoc):
|
||||
self.f.write('</c></p>\n')
|
||||
|
||||
def write_text(self,text):
|
||||
text = string.replace(text,'&','&'); # Must be first
|
||||
text = string.replace(text,'<','<');
|
||||
text = string.replace(text,'>','>');
|
||||
text = text.replace('&','&'); # Must be first
|
||||
text = text.replace('<','<');
|
||||
text = text.replace('>','>');
|
||||
text = text.replace('<super>','<c props="text-position:superscript">')
|
||||
text = text.replace('</super>','</c>')
|
||||
if self.in_table:
|
||||
self.cdata = self.cdata + text
|
||||
else:
|
||||
|
||||
@@ -141,8 +141,8 @@ class PdfDoc(TextDoc.TextDoc):
|
||||
pdf_style.alignment = TA_CENTER
|
||||
else:
|
||||
pdf_style.alignment = TA_JUSTIFY
|
||||
pdf_style.spaceBefore = style.get_padding()
|
||||
pdf_style.spaceAfter = style.get_padding()
|
||||
pdf_style.spaceBefore = style.get_padding()*cm
|
||||
pdf_style.spaceAfter = style.get_padding()*cm
|
||||
pdf_style.textColor = make_color(font.get_color())
|
||||
self.pdfstyles[style_name] = pdf_style
|
||||
|
||||
@@ -158,6 +158,7 @@ class PdfDoc(TextDoc.TextDoc):
|
||||
def start_paragraph(self,style_name,leader=None):
|
||||
self.current_para = self.pdfstyles[style_name]
|
||||
self.my_para = self.style_list[style_name]
|
||||
self.super = "<font size=%d><super>" % (self.my_para.get_font().get_size()-2)
|
||||
if leader==None:
|
||||
self.text = ''
|
||||
else:
|
||||
@@ -167,7 +168,6 @@ class PdfDoc(TextDoc.TextDoc):
|
||||
def end_paragraph(self):
|
||||
if self.in_table == 0 and self.image == 0:
|
||||
self.story.append(Paragraph(self.text,self.current_para))
|
||||
self.story.append(Spacer(1,0.5*cm))
|
||||
else:
|
||||
self.image = 0
|
||||
|
||||
@@ -178,10 +178,11 @@ class PdfDoc(TextDoc.TextDoc):
|
||||
self.text = self.text + '</b>'
|
||||
|
||||
def start_superscript(self):
|
||||
self.text = self.text + '<super>'
|
||||
fsize = self.my_para.get_font().get_size()
|
||||
self.text = self.text + '<font size=%d><super>' % (fsize-2)
|
||||
|
||||
def end_superscript(self):
|
||||
self.text = self.text + '</super>'
|
||||
self.text = self.text + '</super></font>'
|
||||
|
||||
def start_table(self,name,style_name):
|
||||
self.in_table = 1
|
||||
@@ -283,12 +284,12 @@ class PdfDoc(TextDoc.TextDoc):
|
||||
self.image = 1
|
||||
|
||||
def write_text(self,text):
|
||||
text = text.replace('&','&'); # Must be first
|
||||
text = text.replace('<','<');
|
||||
text = text.replace('>','>');
|
||||
text = text.replace('<super>','<super>');
|
||||
text = text.replace('</super>','</super>');
|
||||
self.text = self.text + text.replace('\n','<br>');
|
||||
text = text.replace('&','&') # Must be first
|
||||
text = text.replace('<','<')
|
||||
text = text.replace('>','>')
|
||||
text = text.replace('<super>',self.super)
|
||||
text = text.replace('</super>','</super></font>')
|
||||
self.text = self.text + text.replace('\n','<br>')
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user