From 56543e54f0d57e151047b418317bc496e9bda177 Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Tue, 13 Feb 2007 04:52:07 +0000 Subject: [PATCH] * src/docgen/PSDrawDoc.py: Fix center_text and draw_bar svn: r8103 --- gramps2/ChangeLog | 1 + gramps2/src/docgen/PSDrawDoc.py | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 0d6e24e11..e5febc89a 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -2,6 +2,7 @@ * src/plugins/AncestorChart2.py: Fix title color * src/plugins/DescendChart.py: Fix title color * src/plugins/TimeLine.py: Fix title color + * src/docgen/PSDrawDoc.py: Fix center_text and draw_bar 2007-02-12 Brian Matherly * src/BaseDoc.py: remove write_at diff --git a/gramps2/src/docgen/PSDrawDoc.py b/gramps2/src/docgen/PSDrawDoc.py index 259675526..b40c322a6 100644 --- a/gramps2/src/docgen/PSDrawDoc.py +++ b/gramps2/src/docgen/PSDrawDoc.py @@ -191,13 +191,13 @@ class PSDrawDoc(BaseDoc.BaseDoc): return (new_text,fdef) def center_text(self,style,text,x,y): - x += self.lmargin - y += self.tmargin - stype = self.draw_styles[style] pname = stype.get_paragraph_style() p = self.style_list[pname] + x += self.lmargin + y = y + self.tmargin + ReportUtils.pt2cm(p.get_font().get_size()) + (text,fdef) = self.encode_text(p,text) self.f.write('gsave\n') @@ -361,14 +361,15 @@ class PSDrawDoc(BaseDoc.BaseDoc): y2 = y2 + self.tmargin box_type = self.draw_styles[style] - fill_color = ReportUtils.rgb_color(box_type.get_fill_color()) - color = ReportUtils.rgb_color(box_type.get_color()) - + fill_color = box_type.get_fill_color() + color = box_type.get_color() + self.f.write('gsave\n') self.f.write("%s cm %s cm moveto\n" % coords(self.translate(x1,y1))) - self.f.write("0 %s cm rlineto\n" % gformat(y2-y1)) - self.f.write("%s cm 0 rlineto\n" % gformat(x2-x1)) - self.f.write("0 %s cm rlineto\n" % gformat(y1-y2)) + self.f.write("%s cm %s cm lineto\n" % coords(self.translate(x1,y2))) + self.f.write("%s cm %s cm lineto\n" % coords(self.translate(x2,y2))) + self.f.write("%s cm %s cm lineto\n" % coords(self.translate(x2,y1))) + self.f.write("%s cm %s cm lineto\n" % coords(self.translate(x1,y1))) self.f.write('closepath\n') self.f.write("%s setlinewidth\n" % gformat(box_type.get_line_width())) self.f.write('gsave %s %s %s setrgbcolor fill grestore\n' % lrgb(fill_color))