diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 78ce7d53b..c6dfa18f6 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -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 * src/docgen/AbiWord2Doc.py: fix spacing for top and bottom margin diff --git a/gramps2/src/docgen/PSDrawDoc.py b/gramps2/src/docgen/PSDrawDoc.py index 7be971cd2..63ca56122 100644 --- a/gramps2/src/docgen/PSDrawDoc.py +++ b/gramps2/src/docgen/PSDrawDoc.py @@ -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] diff --git a/gramps2/test/runtest.sh b/gramps2/test/runtest.sh index 59f4ec5cb..adb157fb8 100755 --- a/gramps2/test/runtest.sh +++ b/gramps2/test/runtest.sh @@ -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