* src/docgen/OpenOfficeDoc.py: proper handling of center_text
* src/docgen/PdfDoc.py: proper handling of center_text * src/plugins/TimeLine.py: switch to using center_text instead of draw_text * src/plugins/AncestorChart2.py: switch to using center_text instead of draw_text svn: r2623
This commit is contained in:
@@ -876,7 +876,11 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
||||
|
||||
pstyle = self.style_list[para_name]
|
||||
font = pstyle.get_font()
|
||||
sw = FontScale.string_width(font,text)*1.3
|
||||
if box_style.get_width():
|
||||
sw = box_style.get_width()
|
||||
else:
|
||||
sw = FontScale.string_width(font,text)*1.3
|
||||
|
||||
|
||||
self.f.write('<draw:text-box draw:style-name="%s" ' % style)
|
||||
self.f.write('draw:layer="layout" ')
|
||||
@@ -946,15 +950,15 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
||||
pstyle = self.style_list[para_name]
|
||||
font = pstyle.get_font()
|
||||
|
||||
size = (FontScale.string_width(font,text)/72.0) * 2.54
|
||||
size = 1.1*(FontScale.string_width(font,text)/72.0) * 2.54
|
||||
|
||||
self.f.write('<draw:text-box text:anchor-type="paragraph" ')
|
||||
self.f.write('draw:style-name="%s" ' % style)
|
||||
self.f.write('draw:z-index="0" ')
|
||||
self.f.write('svg:width="%.3fcm" ' % self.get_usable_width())
|
||||
self.f.write('svg:width="%.3fcm" ' % size)
|
||||
self.f.write('svg:height="%dpt" ' % (font.get_size()*1.1))
|
||||
|
||||
self.f.write('svg:x="0cm" ')
|
||||
self.f.write('svg:x="%.3fcm" ' % (x-(size/2.0)))
|
||||
self.f.write('svg:y="%.3fcm">\n' % float(y))
|
||||
|
||||
if text != "":
|
||||
|
@@ -29,15 +29,16 @@ import BaseDoc
|
||||
import Plugins
|
||||
import Errors
|
||||
import ImgManip
|
||||
import FontScale
|
||||
from gettext import gettext as _
|
||||
|
||||
_H = 'Helvetica'
|
||||
_HB = 'Helvetica-Bold'
|
||||
_HO = 'Helvetica-Oblique'
|
||||
_H = 'Helvetica'
|
||||
_HB = 'Helvetica-Bold'
|
||||
_HO = 'Helvetica-Oblique'
|
||||
_HBO = 'Helvetica-BoldOblique'
|
||||
_T = 'Times-Roman'
|
||||
_TB = 'Times-Bold'
|
||||
_TI = 'Times-Italic'
|
||||
_T = 'Times-Roman'
|
||||
_TB = 'Times-Bold'
|
||||
_TI = 'Times-Italic'
|
||||
_TBI = 'Times-BoldItalic'
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@@ -449,8 +450,13 @@ class PdfDoc(BaseDoc.BaseDoc):
|
||||
sc = make_color(font.get_color())
|
||||
fc = make_color(font.get_color())
|
||||
fnt = self.pdf_set_font(font)
|
||||
s = reportlab.graphics.shapes.String(x*cm,
|
||||
y,
|
||||
if p.get_alignment() == BaseDoc.PARA_ALIGN_CENTER:
|
||||
twidth = ((FontScale.string_width(font,str(text)))/2.0)*cm
|
||||
xcm = (stype.get_width() - x) - twidth
|
||||
else:
|
||||
xcm = x * cm
|
||||
s = reportlab.graphics.shapes.String(xcm,
|
||||
y-size,
|
||||
str(text),
|
||||
strokeColor=sc,
|
||||
fillColor=fc,
|
||||
|
Reference in New Issue
Block a user