class_docstr: A class that converts strings to paths.
class_docstr_tok: ["A","class","that","converts","strings","to","paths","."]
docstr: Parse mathtext string *s* and convert it to a (vertices, codes) pair.
docstr_tok: ["Parse","mathtext","string","*","s","*","and","convert","it","to","a","(","vertices",",","codes",")","pair","."]
code: def get_glyphs_mathtext(
      self, prop, s, glyph_map=None, return_new_glyphs_only=False
  ):
      """
      Parse mathtext string *s* and convert it to a (vertices, codes) pair.
      """
  
      prop = prop.copy()
      prop.set_size(self.FONT_SCALE)
  
      (
          width,
          height,
          descent,
          glyphs,
          rects,
      ) = self.mathtext_parser.parse(s, self.DPI, prop)
  
      if not glyph_map:
          glyph_map = OrderedDict()
  
      if return_new_glyphs_only:
          glyph_map_new = OrderedDict()
      else:
          glyph_map_new = glyph_map
  
      xpositions = []
      ypositions = []
      glyph_ids = []
      sizes = []
  
      for font, fontsize, ccode, ox, oy in glyphs:
          char_id = self._get_char_id(font, ccode)
          if char_id not in glyph_map:
              font.clear()
              font.set_size(self.FONT_SCALE, self.DPI)
              font.load_char(ccode, flags=LOAD_NO_HINTING)
              glyph_map_new[char_id] = font.get_path()
  
          xpositions.append(ox)
          ypositions.append(oy)
          glyph_ids.append(char_id)
          size = fontsize / self.FONT_SCALE
          sizes.append(size)
  
      myrects = []
      for ox, oy, w, h in rects:
          vert1 = [
              (ox, oy),
              (ox, oy + h),
              (ox + w, oy + h),
              (ox + w, oy),
              (ox, oy),
              (0, 0),
          ]
          code1 = [
              Path.MOVETO,
              Path.LINETO,
              Path.LINETO,
              Path.LINETO,
              Path.LINETO,
              Path.CLOSEPOLY,
          ]
          myrects.append((vert1, code1))
  
      return (
          list(zip(glyph_ids, xpositions, ypositions, sizes)),
          glyph_map_new,
          myrects,
      )
  
imports: from collections import OrderedDict
  import logging
  import urllib.parse
  import numpy
  from matplotlib import _text_helpers, dviread
  from matplotlib.font_manager import FontProperties, get_font, fontManager
  from matplotlib.ft2font import LOAD_NO_HINTING, LOAD_TARGET_LIGHT
  from matplotlib.mathtext import MathTextParser
  from matplotlib.path import Path
  from matplotlib.texmanager import TexManager
  from matplotlib.transforms import Affine2D
label_desc: Use image node_id 8 for calling the TextToPath obj's underlying member method code with example usage: obj.get_glyphs_mathtext(prop, s, glyph_map, return_new_glyphs_only) and returns: list,  glyph_map_new,  myrects