Exemple #1
0
    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)
Exemple #2
0
    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)
Exemple #3
0
    def group(self):
        group = g()
        self.svg.addElement(group)

        return SVGImageDrawElement(group, self)
Exemple #4
0
    def group(self):
        group = g()
        self.svg.addElement(group)

        return SVGImageDrawElement(group, self)