* src/docgen/PdfDoc.py: fix typo
svn: r2115
This commit is contained in:
parent
dab655e2ac
commit
57726ddf93
@ -48,6 +48,11 @@ try:
|
|||||||
from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
|
from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
|
||||||
import reportlab.graphics.shapes
|
import reportlab.graphics.shapes
|
||||||
import reportlab.lib.styles
|
import reportlab.lib.styles
|
||||||
|
from reportlab.pdfbase.pdfmetrics import *
|
||||||
|
|
||||||
|
for faceName in reportlab.pdfbase.pdfmetrics.standardFonts:
|
||||||
|
reportlab.pdfbase.pdfmetrics.registerTypeFace(reportlab.pdfbase.pdfmetrics.TypeFace(faceName))
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise Errors.PluginError( _("The ReportLab modules are not installed"))
|
raise Errors.PluginError( _("The ReportLab modules are not installed"))
|
||||||
|
|
||||||
@ -113,20 +118,20 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
pdf_style.fontName = "Times-Bold"
|
pdf_style.fontName = "Times-Bold"
|
||||||
else:
|
else:
|
||||||
if font.get_italic():
|
if font.get_italic():
|
||||||
pdf_style.fontName = "Times-Italic"
|
pdf_style.fontName = _TB
|
||||||
else:
|
else:
|
||||||
pdf_style.fontName = "Times-Roman"
|
pdf_style.fontName = _T
|
||||||
else:
|
else:
|
||||||
if font.get_bold():
|
if font.get_bold():
|
||||||
if font.get_italic():
|
if font.get_italic():
|
||||||
pdf_style.fontName = "Helvetica-BoldOblique"
|
pdf_style.fontName = "Helvetica-BoldOblique"
|
||||||
else:
|
else:
|
||||||
pdf_style.fontName = "Helvetica-Bold"
|
pdf_style.fontName = _HB
|
||||||
else:
|
else:
|
||||||
if font.get_italic():
|
if font.get_italic():
|
||||||
pdf_style.fontName = "Helvetica-Oblique"
|
pdf_style.fontName = "Helvetica-Oblique"
|
||||||
else:
|
else:
|
||||||
pdf_style.fontName = "Helvetica"
|
pdf_style.fontName = _H
|
||||||
pdf_style.bulletFontName = pdf_style.fontName
|
pdf_style.bulletFontName = pdf_style.fontName
|
||||||
|
|
||||||
right = style.get_right_margin()*cm
|
right = style.get_right_margin()*cm
|
||||||
@ -162,7 +167,9 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
errmsg = "%s\n%s" % (_("Could not create %s") % self.filename, msg)
|
errmsg = "%s\n%s" % (_("Could not create %s") % self.filename, msg)
|
||||||
raise Errors.ReportError(errmsg)
|
raise Errors.ReportError(errmsg)
|
||||||
except:
|
except:
|
||||||
raise Errors.ReportError(_("Could not create %s") % self.filename)
|
import DisplayTrace
|
||||||
|
DisplayTrace.DisplayTrace()
|
||||||
|
# raise Errors.ReportError(_("Could not create %s") % self.filename)
|
||||||
|
|
||||||
def page_break(self):
|
def page_break(self):
|
||||||
self.story.append(PageBreak())
|
self.story.append(PageBreak())
|
||||||
@ -244,14 +251,14 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
f = p.get_font()
|
f = p.get_font()
|
||||||
if f.get_type_face() == BaseDoc.FONT_SANS_SERIF:
|
if f.get_type_face() == BaseDoc.FONT_SANS_SERIF:
|
||||||
if f.get_bold():
|
if f.get_bold():
|
||||||
fn = 'Helvetica-Bold'
|
fn = _HB
|
||||||
else:
|
else:
|
||||||
fn = 'Helvetica'
|
fn = _H
|
||||||
else:
|
else:
|
||||||
if f.get_bold():
|
if f.get_bold():
|
||||||
fn = 'Times-Bold'
|
fn = _TB
|
||||||
else:
|
else:
|
||||||
fn = 'Times-Roman'
|
fn = _T
|
||||||
|
|
||||||
black = Color(0,0,0)
|
black = Color(0,0,0)
|
||||||
|
|
||||||
@ -402,13 +409,13 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
sc = make_color(font.get_color())
|
sc = make_color(font.get_color())
|
||||||
fc = make_color(font.get_color())
|
fc = make_color(font.get_color())
|
||||||
fnt = self.pdf_set_font(font),
|
fnt = self.pdf_set_font(font),
|
||||||
s = reportlab.graphics.shape.String(x*cm,
|
s = reportlab.graphics.shapes.String(x*cm,
|
||||||
y,
|
y,
|
||||||
str(text),
|
str(text),
|
||||||
strokeColor=sc,
|
strokeColor=sc,
|
||||||
fillColor=fc,
|
fillColor=fc,
|
||||||
fontName=fnt,
|
fontName=fnt,
|
||||||
fontSize=size)
|
fontSize=size)
|
||||||
self.drawing.add(s)
|
self.drawing.add(s)
|
||||||
|
|
||||||
def pdf_set_font(self,font):
|
def pdf_set_font(self,font):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user