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 |