reportlab/graphics/renderPS.py
changeset 2574 d81949596070
parent 2570 7b93b3b42e51
child 2678 38d18a697cd0
equal deleted inserted replaced
2573:273f77e79536 2574:d81949596070
   239 
   239 
   240     def drawCentredString(self, x, y, text, text_anchor='middle'):
   240     def drawCentredString(self, x, y, text, text_anchor='middle'):
   241         if self._fillColor is not None:
   241         if self._fillColor is not None:
   242             textLen = stringWidth(text, self._font,self._fontSize)
   242             textLen = stringWidth(text, self._font,self._fontSize)
   243             if text_anchor=='end':
   243             if text_anchor=='end':
   244                 x = x-textLen
   244                 x -= textLen
   245             elif text_anchor=='middle':
   245             elif text_anchor=='middle':
   246                 x = x - textLen/2
   246                 x -= textLen/2.
   247             self.drawString(x,y,text)
   247             self.drawString(x,y,text)
   248 
   248 
   249     def drawRightString(self, text, x, y):
   249     def drawRightString(self, text, x, y):
   250         self.drawCentredString(text,x,y,text_anchor='end')
   250         self.drawCentredString(text,x,y,text_anchor='end')
   251 
   251