(self)
return x_bearing, y_bearing, width, height, x_advance, y_advance
Returns the X-bearing, Y-bearing, width, height, X-advance and
        Y-advance of the text.

        For multi-line text, the X-bearing and Y-bearing correspond to the
        first line, while the X-advance is extracted from the last line.
        and the Y-advance is the sum of all the Y-advances. The width and
        height correspond to the entire bounding box of the text.
Returns the X-bearing, Y-bearing, width, height, X-advance and
        Y-advance of the text.
Returns the X - bearing Y - bearing width height X - advance and Y - advance of the text .
def text_extents(self):
        """Returns the X-bearing, Y-bearing, width, height, X-advance and
        Y-advance of the text.

        For multi-line text, the X-bearing and Y-bearing correspond to the
        first line, while the X-advance is extracted from the last line.
        and the Y-advance is the sum of all the Y-advances. The width and
        height correspond to the entire bounding box of the text."""
        lines = self.text.split("\n")
        if len(lines) <= 1:
            return self.context.text_extents(self.text)

        (
            x_bearing,
            y_bearing,
            width,
            height,
            x_advance,
            y_advance,
        ) = self.context.text_extents(lines[0])

        line_height = self.context.font_extents()[2]
        for line in lines[1:]:
            _, _, w, _, x_advance, ya = self.context.text_extents(line)
            width = max(width, w)
            height += line_height
            y_advance += ya

        return x_bearing, y_bearing, width, height, x_advance, y_advance
def text_extents ( self ) : lines = self . text . split ( "\n" ) if len ( lines ) <= 1 : return self . context . text_extents ( self . text ) ( x_bearing , y_bearing , width , height , x_advance , y_advance , ) = self . context . text_extents ( lines [ 0 ] ) line_height = self . context . font_extents ( ) [ 2 ] for line in lines [ 1 : ] : _ , _ , w , _ , x_advance , ya = self . context . text_extents ( line ) width = max ( width , w ) height += line_height y_advance += ya return x_bearing , y_bearing , width , height , x_advance , y_advance