Advertisement
mirovlad

vertical text 1.1

Aug 2nd, 2022 (edited)
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. class verticalText1(Flowable): # Rotates a text in a table cell.
  2.  
  3.     def __init__(self, text, pos_x=26, pos_y=3):
  4.         Flowable.__init__(self)
  5.         self.pos_x = pos_x
  6.         self.pos_y = pos_y
  7.         self.text = text
  8.  
  9.     def draw(self):
  10.         canvas = self.canv
  11.         canvas.rotate(90)
  12.         fs = canvas._fontsize
  13.         # Измества канваса малко надясно
  14.         canvas.translate(1, -fs/1.2)  # canvas._leading?
  15.         #canvas.drawString(0, 0, self.text)
  16.         draw_wrapped_line(canvas, self.text, 16, self.pos_x, self.pos_y, 7)
  17.  
  18.     def wrap(self, aW, aH):
  19.         canv = self.canv
  20.         fn, fs = canv._fontname, canv._fontsize
  21.         return canv._leading, 1 + canv.stringWidth(self.text, fn, fs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement