godot/component/text.py
def _draw_mainlayer(self, gc, view_bounds=None, mode="default"):
        """ Draws the component """

        gc.save_state()
        try:
            # Specify the font
            font = str_to_font(str(self.pen.font))
            gc.set_font(font)

            gc.set_fill_color(self.pen.color_)

            x = self.text_x - ( self.text_w / 2 )
            y = self.text_y - ( font.size / 2 )

            # Show text at the same scale as the graphics context
            ctm = gc.get_ctm()
            if hasattr(ctm, "__len__") and len(ctm) == 6:
                scale = sqrt( (ctm[0] + ctm[1]) * (ctm[0] + ctm[1]) / 2.0 + \
                              (ctm[2] + ctm[3]) * (ctm[2] + ctm[3]) / 2.0 )
            elif hasattr(gc, "get_ctm_scale"):
                scale = gc.get_ctm_scale()
            else:
                raise RuntimeError("Unable to get scale from GC.")
            x *= scale
            y *= scale
            gc.show_text_at_point(self.text, x, y)
        finally:
            gc.restore_state()
def _draw_mainlayer(self, gc, view_bounds=None, mode="default"):
        """ Draws the component """

        gc.save_state()
        try:
            # Specify the font
            font = str_to_font(str(self.pen.font))
            gc.set_font(font)

            gc.set_fill_color(self.pen.color_)

            x = self.text_x - ( self.text_w / 2 )
            y = self.text_y - ( font.size / 2 )

            # Show text at the same scale as the graphics context
            ctm = gc.get_ctm()
            if hasattr(ctm, "__len__") and len(ctm) == 6:
                scale = sqrt( (ctm[0] + ctm[1]) * (ctm[0] + ctm[1]) / 2.0 + \
                              (ctm[2] + ctm[3]) * (ctm[2] + ctm[3]) / 2.0 )
            elif hasattr(gc, "get_ctm_scale"):
                scale = gc.get_ctm_scale()
            else:
                raise RuntimeError("Unable to get scale from GC.")
            x *= scale
            y *= scale
            gc.show_text_at_point(self.text, x, y)
        finally:
            gc.restore_state()
Draws the component