# Path: rst2pdf/log.py
# def nodeid(node):


import os
import re
import tempfile
            import Image
            import ImageFont
            import ImageDraw
from reportlab.platypus.flowables import Flowable
from reportlab.platypus import SimpleDocTemplate
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from .log import log
    from matplotlib import mathtext
    from matplotlib.font_manager import FontProperties
    from matplotlib.colors import to_rgb
            from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY
            from PIL import (
                Image,
                ImageFont,
                ImageDraw,
            )
                canv.translate(x, y + descent)

                for font, fontsize, num, ox, oy in glyphs:
                    fontname = font.fname
                    if fontname not in fonts:
                        fonts[fontname] = fontname
                        pdfmetrics.registerFont(TTFont(fontname, fontname))
                    canv.setFont(fontname, fontsize)
                    rgb_color = to_rgb(self.color)
                    canv.setFillColorRGB(rgb_color[0], rgb_color[1], rgb_color[2])
                    canv.drawString(ox, oy, chr(num))

                canv.setLineWidth(0)
                canv.setDash([])
                for ox, oy, width, height in rects:
                    canv.rect(ox, oy + height, width, height, fill=1)
            except Exception as e:
                log.error(f"Math error: {e}")
                log.exception("Math error!")
                canv.translate(x, y)
                rgb_color = to_rgb(self.color)
                canv.setFillColorRGB(rgb_color[0], rgb_color[1], rgb_color[2])
                canv.drawString(0, 0, self.s)
            canv.restoreState()
        else:
            canv.saveState()
            canv.translate(x, y)
            canv.drawString(x, y, self.s)
            canv.restoreState()
        if self.label:

# Path: rst2pdf/log.py
# def nodeid(node):


# Path: rst2pdf/math_flowable.py
import os
import re
import tempfile
            import Image
            import ImageFont
            import ImageDraw
from reportlab.platypus.flowables import Flowable
from reportlab.platypus import SimpleDocTemplate
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from .log import log
    from matplotlib import mathtext
    from matplotlib.font_manager import FontProperties
    from matplotlib.colors import to_rgb
            from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY
            from PIL import (
                Image,
                ImageFont,
                ImageDraw,
            )

                canv.translate(x, y + descent)

                for font, fontsize, num, ox, oy in glyphs:
                    fontname = font.fname
                    if fontname not in fonts:
                        fonts[fontname] = fontname
                        pdfmetrics.registerFont(TTFont(fontname, fontname))
                    canv.setFont(fontname, fontsize)
                    rgb_color = to_rgb(self.color)
                    canv.setFillColorRGB(rgb_color[0], rgb_color[1], rgb_color[2])
                    canv.drawString(ox, oy, chr(num))

                canv.setLineWidth(0)
                canv.setDash([])
                for ox, oy, width, height in rects:
                    canv.rect(ox, oy + height, width, height, fill=1)
            except Exception as e:
                log.error(f"Math error: {e}")
                log.exception("Math error!")
                canv.translate(x, y)
                rgb_color = to_rgb(self.color)
                canv.setFillColorRGB(rgb_color[0], rgb_color[1], rgb_color[2])
                canv.drawString(0, 0, self.s)
            canv.restoreState()
        else:
            canv.saveState()
            canv.translate(x, y)
            canv.drawString(x, y, self.s)
            canv.restoreState()
        if self.label:

            log.info('Drawing equation-%s' % self.label)