docs: def text_extents(self, text):
          """Returns the extents for a string of text.
  
          The extents describe a user-space rectangle
          that encloses the "inked" portion of the text,
          (as it would be drawn by :meth:`show_text`).
          Additionally, the :obj:`x_advance` and :obj:`y_advance` values
          indicate the amount by which the current point would be advanced
          by :meth:`show_text`.
  
          Note that whitespace characters do not directly contribute
          to the size of the rectangle (:obj:`width` and :obj:`height`).
          They do contribute indirectly by changing the position
          of non-whitespace characters.
          In particular, trailing whitespace characters are likely
          to not affect the size of the rectangle,
          though they will affect the x_advance and y_advance values.
  
          Because text extents are in user-space coordinates,
          they are mostly, but not entirely,
          independent of the current transformation matrix.
          If you call :meth:`context.scale(2) <scale>`,
          text will be drawn twice as big,
          but the reported text extents will not be doubled.
          They will change slightly due to hinting
          (so you can't assume that metrics are independent
          of the transformation matrix),
          but otherwise will remain unchanged.
  
          :param text: The text to measure, as an Unicode or UTF-8 string.
          :returns:
              A ``(x_bearing, y_bearing, width, height, x_advance, y_advance)``
              tuple of floats.
  
          :obj:`x_bearing`
              The horizontal distance
              from the origin to the leftmost part of the glyphs as drawn.
              Positive if the glyphs lie entirely to the right of the origin.
  
          :obj:`y_bearing`
              The vertical distance
              from the origin to the topmost part of the glyphs as drawn.
              Positive only if the glyphs lie completely below the origin;
              will usually be negative.
  
          :obj:`width`
              Width of the glyphs as drawn.
  
          :obj:`height`
              Height of the glyphs as drawn.
  
          :obj:`x_advance`
              Distance to advance in the X direction
              after drawing these glyphs.
  
          :obj:`y_advance`
              Distance to advance in the Y direction
              after drawing these glyphs.
              Will typically be zero except for vertical text layout
              as found in East-Asian languages.
  
          """
          extents = ffi.new('cairo_text_extents_t *')
          cairo.cairo_text_extents(self._pointer, _encode_string(text), extents)
          self._check_status()
          # returning extents as is would be a nice API,
          # but return a tuple for compat with pycairo.
          return (
              extents.x_bearing, extents.y_bearing,
              extents.width, extents.height,
              extents.x_advance, extents.y_advance)