* src/docgen/PSDrawDoc.py (encode): Add tolerant encoder;

(patch_text): Remove unused method.


svn: r5428
This commit is contained in:
Alex Roitman 2005-11-24 01:34:45 +00:00
parent 3c426c0ffc
commit bf7c2849ae
3 changed files with 12 additions and 8 deletions

View File

@ -7,6 +7,8 @@
* example/gramps/example.gramps: Correct errors.
* src/BaseDoc.py (SheetParser.startElement): Tolerate missing
tmargin and bmargin (when reading older style files).
* src/docgen/PSDrawDoc.py (encode): Add tolerant encoder;
(patch_text): Remove unused method.
2005-11-22 Don Allingham <don@gramps-project.org>
* src/docgen/AbiWord2Doc.py: fix spacing for top and bottom margin

View File

@ -154,13 +154,17 @@ class PSDrawDoc(BaseDoc.BaseDoc):
self.f.write('showpage\n')
self.f.write('%%PageTrailer\n')
def encode_text(self,p,text):
fdef = self.fontdef(p)
def encode(self,text):
try:
orig = unicode(text)
new_text = orig.encode('iso-8859-1')
except:
new_text = "?"
new_text = "?"*len(text)
return new_text
def encode_text(self,p,text):
fdef = self.fontdef(p)
new_text = self.encode(text)
return (new_text,fdef)
def center_text(self,style,text,x,y):
@ -274,7 +278,8 @@ class PSDrawDoc(BaseDoc.BaseDoc):
y = ((size * val)/2.0) - size
for line in text:
self.f.write('(%s) dup stringwidth pop -2 div '% line.encode('iso-8859-1'))
self.f.write('(%s) dup stringwidth pop -2 div '
% self.encode(line))
self.f.write("%s moveto show\n" % gformat(y))
y -= size
@ -325,9 +330,6 @@ class PSDrawDoc(BaseDoc.BaseDoc):
self.f.write('%s %s %s setrgbcolor stroke\n' % lrgb(stype.get_color()))
self.f.write('grestore\n')
def patch_text(self,text):
return text.encode('iso-8859-1')
def write_at(self,style,text,x,y):
para_style = self.style_list[style]

View File

@ -23,7 +23,7 @@ OPTS="-i $EXAMPLE_XML"
GRPH_FMT="sxw ps pdf svg"
TEXT_FMT="sxw pdf kwd abw rtf txt"
GRPH_REP="ancestor_chart ancestor_chart2 descendant_graph"
GRPH_REP="ancestor_chart2 descend_chart2 fan_chart statistics_chart timeline"
TEXT_REP="ancestor_report ancestors_report descend_report det_ancestor_report det_descendant_report family_group"
# Single run with all graphical reports in all formats