def contents(self):
        """Get svg string
        """
        c = self._header[:]
        c.append(' font-weight="{}"'.format(self.font_weight))
        c.append(' font-family="{}"'.format(self.font_family))
        c.append(' width="{}" height="{}"'.format(*self.screen_size))
        sclw = self.original_size[0] * self.scale_factor
        sclh = self.original_size[1] * self.scale_factor
        longside = max([sclw, sclh])
        width = round(longside + self.margin * 2, 2)
        height = round(longside + self.margin * 2, 2)
        xleft = round(-self.margin - (longside - sclw) / 2, 2)
        ytop = round(-self.margin - (longside - sclh) / 2, 2)
        c.append(' viewBox="{} {} {} {}">\n'.format(
            xleft, ytop, width, height))
        if self.bgcolor is not None:
            c.append('<rect x="{}", y="{}" width="{}" height="{}" fill="{}" \
                />\n'.format(xleft, ytop, width, height, self.bgcolor))
        c.extend(self._elems)
        c.append("</svg>")
        return "".join(c)
Get svg string