* src/docgen/PdfDoc.py: 0000870: docgen/PdfDoc.py offset error, and missing italics

svn: r7968
This commit is contained in:
Brian Matherly 2007-01-24 12:53:51 +00:00
parent b366d35f06
commit d4a93c5f12
2 changed files with 25 additions and 43 deletions

View File

@ -1,3 +1,7 @@
2007-01-24 Douglas Blank <dblank@cs.brynmawr.edu>
* src/docgen/PdfDoc.py: 0000870: docgen/PdfDoc.py offset error,
and missing italics
2007-01-23 Don Allingham <don@gramps-project.org> 2007-01-23 Don Allingham <don@gramps-project.org>
* src/DataViews/_MediaView.py: add view option * src/DataViews/_MediaView.py: add view option
* src/images/Makefile.am: add stock_zoom * src/images/Makefile.am: add stock_zoom

View File

@ -153,28 +153,7 @@ class PdfDoc(BaseDoc.BaseDoc):
pdf_style.bulletFontSize = font.get_size() pdf_style.bulletFontSize = font.get_size()
pdf_style.leading = font.get_size()*1.2 pdf_style.leading = font.get_size()*1.2
if font.get_type_face() == BaseDoc.FONT_SERIF: pdf_style.fontName = self.pdf_set_font(font)
if font.get_bold():
if font.get_italic():
pdf_style.fontName = _TBI
else:
pdf_style.fontName = _TB
else:
if font.get_italic():
pdf_style.fontName = _TI
else:
pdf_style.fontName = _T
else:
if font.get_bold():
if font.get_italic():
pdf_style.fontName = _HBO
else:
pdf_style.fontName = _HB
else:
if font.get_italic():
pdf_style.fontName = _HO
else:
pdf_style.fontName = _H
pdf_style.bulletFontName = pdf_style.fontName pdf_style.bulletFontName = pdf_style.fontName
pdf_style.rightIndent = style.get_right_margin()*cm pdf_style.rightIndent = style.get_right_margin()*cm
@ -298,17 +277,7 @@ class PdfDoc(BaseDoc.BaseDoc):
p = self.my_para p = self.my_para
f = p.get_font() f = p.get_font()
if f.get_type_face() == BaseDoc.FONT_SANS_SERIF: fn = self.pdf_set_font(f)
if f.get_bold():
fn = _HB
else:
fn = _H
else:
if f.get_bold():
fn = _TB
else:
fn = _T
black = Color(0,0,0) black = Color(0,0,0)
for inc in range(self.col,self.col+self.span): for inc in range(self.col,self.col+self.span):
@ -550,7 +519,7 @@ class PdfDoc(BaseDoc.BaseDoc):
else: else:
xcm = x * cm xcm = x * cm
s = reportlab.graphics.shapes.String(xcm, s = reportlab.graphics.shapes.String(xcm,
y-size, y - size,
enc(text), enc(text),
strokeColor=sc, strokeColor=sc,
fillColor=fc, fillColor=fc,
@ -558,17 +527,26 @@ class PdfDoc(BaseDoc.BaseDoc):
fontSize=size) fontSize=size)
self.drawing.add(s) self.drawing.add(s)
def pdf_set_font(self,font): def pdf_set_font(self, font):
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF: if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
if font.get_bold(): if font.get_bold() and font.get_italic():
return _HB fn = _HBO
elif font.get_bold():
fn = _HB
elif font.get_italic():
fn = _HO
else: else:
return _H fn = _H
else: else:
if font.get_bold(): if font.get_bold() and font.get_italic():
return _TB fn = _TBI
elif font.get_bold():
fn = _TB
elif font.get_italic():
fn = _TI
else: else:
return _T fn = _T
return fn
def rotate_text(self,style,text,x,y,angle): def rotate_text(self,style,text,x,y,angle):
stype = self.draw_styles[style] stype = self.draw_styles[style]
@ -603,12 +581,12 @@ class PdfDoc(BaseDoc.BaseDoc):
p = self.style_list[pname] p = self.style_list[pname]
font = p.get_font() font = p.get_font()
yt = (self.get_usable_height()*cm) - (y*cm) yt = (self.get_usable_height()*cm) - (y*cm)
size = font.get_size()
fnt = self.pdf_set_font(font) fnt = self.pdf_set_font(font)
sc = make_color(font.get_color()) sc = make_color(font.get_color())
fc = make_color(font.get_color()) fc = make_color(font.get_color())
s = reportlab.graphics.shapes.String(x*cm, s = reportlab.graphics.shapes.String(x*cm,
yt, yt - size,
enc(text), enc(text),
fontName=fnt, fontName=fnt,
fontSize=font.get_size(), fontSize=font.get_size(),