class_docstr: Class that draws text on a Cairo context.
  
  This class supports multi-line text unlike the original Cairo text
  drawing methods.
class_docstr_tok: ["Class","that","draws","text","on","a","Cairo","context",".","This","class","supports","multi-line","text","unlike","the","original","Cairo","text","drawing","methods","."]
docstr: 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.
docstr_tok: ["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","."]
code: 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
  
file_path: python-igraph/src/igraph/drawing/cairo/text.py
imports: import re
  from warnings import warn
  from igraph.drawing.cairo.base import AbstractCairoDrawer
label_desc: Use image node_id 9 for calling the CairoTextDrawer obj's underlying member method code with example usage: obj.text_extents() and returns: x_bearing,  y_bearing,  width,  height,  x_advance,  y_advance, self