from reportlab.graphics.shapes import String

class utils:
    # Gets width of a string
    # Note: Don't work perfectly with some imported fonts!
    def getStringWidth(text):
        dummyChar = String(0, 0, text)
        # returns:
        # (x0, y0, x1, y1)
        # x0 and y0 start point
        # x1 and y1 end point
        bounds = dummyChar.getBounds()
        xPosStart = bounds[0]
        xPosEnd = bounds[2]

        return xPosEnd - xPosStart
3564bf174c60918d9596dd4ccd0556fbff176bc2
<mask token>

<mask token>


class utils:
    <mask token>

<mask token>


class utils:

    def getStringWidth(text):
        dummyChar = String(0, 0, text)
        bounds = dummyChar.getBounds()
        xPosStart = bounds[0]
        xPosEnd = bounds[2]
        return xPosEnd - xPosStart

from reportlab.graphics.shapes import String


class utils:

    def getStringWidth(text):
        dummyChar = String(0, 0, text)
        bounds = dummyChar.getBounds()
        xPosStart = bounds[0]
        xPosEnd = bounds[2]
        return xPosEnd - xPosStart

from reportlab.graphics.shapes import String

class utils:
    # Gets width of a string
    # Note: Don't work perfectly with some imported fonts!
    def getStringWidth(text):
        dummyChar = String(0, 0, text)
        # returns:
        # (x0, y0, x1, y1)
        # x0 and y0 start point
        # x1 and y1 end point
        bounds = dummyChar.getBounds()
        xPosStart = bounds[0]
        xPosEnd = bounds[2]

        return xPosEnd - xPosStart