def rotated_textarea(self, box, string, font, **kwargs): angle = int(kwargs['rotate']) % 360 del kwargs['rotate'] if angle in (90, 270): _box = Box(box[0], box[1], box[0] + box.height, box[1] + box.width) if angle == 90: _box = _box.shift(x=box.width) elif angle == 270: _box = _box.shift(y=box.height) elif angle == 180: _box = Box(box[2], box[3], box[2] + box.width, box[3] + box.height) else: _box = Box(box[0], box[1], box[0] + box.width, box[1] + box.height) rotate = "rotate(%d,%d,%d)" % (angle, _box[0], _box[1]) group = g(transform="%s" % rotate) self.svg.addElement(group) elem = SVGImageDrawElement(group, self) elem.textarea(_box, string, font, **kwargs)
def rotated_textarea(self, box, string, font, **kwargs): angle = int(kwargs["rotate"]) % 360 del kwargs["rotate"] if angle in (90, 270): _box = Box(box[0], box[1], box[0] + box.height, box[1] + box.width) if angle == 90: _box = _box.shift(x=box.width) elif angle == 270: _box = _box.shift(y=box.height) elif angle == 180: _box = Box(box[2], box[3], box[2] + box.width, box[3] + box.height) else: _box = Box(box[0], box[1], box[0] + box.width, box[1] + box.height) rotate = "rotate(%d,%d,%d)" % (angle, _box[0], _box[1]) group = g(transform="%s" % rotate) self.svg.addElement(group) elem = SVGImageDrawElement(group, self) elem.textarea(_box, string, font, **kwargs)
def group(self): group = g() self.svg.addElement(group) return SVGImageDrawElement(group, self)