Repository: 3b1b/manim
File: manimlib/mobject/svg/text_mobject.py (Python)

Code before:
        'gradient': None,
        'lsh': -1,
        'size': 1,
        'slant': NORMAL,
        'weight': NORMAL,
        't2c': {},
        't2f': {},
        't2g': {},
        't2s': {},
        't2w': {},
        'tab_width': 4,
    }

    def __init__(self, text, **config):
        self.full2short(config)
        digest_config(self, config)
        if text.find('\t') != -1:
            text = text.replace('\t', ' '*self.tab_width)
        self.text = text
        self.lsh = self.size if self.lsh == -1 else self.lsh

        file_name = self.text2svg()
        self.remove_last_M(file_name)
        SVGMobject.__init__(self, file_name, **config)
        self.apply_space_chars()
        self.move_into_position()

        nppc = self.n_points_per_cubic_curve
        for each in self:
            if len(each.points) == 0:
                continue
            points = each.points
            last = points[0]
            each.clear_points()
            for index, point in enumerate(points):
                each.append_points([point])
                if index != len(points) - 1 and (index + 1) % nppc == 0 and any(point != points[index+1]):
                    each.add_line_to(last)
                    last = points[index + 1]
            each.add_line_to(last)

        if self.t2c:
            self.set_color_by_t2c()
        if self.gradient:
            self.set_color_by_gradient(*self.gradient)
        if self.t2g:
            self.set_color_by_t2g()

        # anti-aliasing
        self.scale(TEXT_MOB_SCALE_FACTOR)


Review comment (suggestion):
I think here has a problem, if `self.height` or `self.width` is defined, it will set_height/width. But at the end of `__init__()`, it scale(0.05) whether height is defined or not.

Code after:
        'gradient': None,
        'lsh': -1,
        'size': 1,
        'slant': NORMAL,
        'weight': NORMAL,
        't2c': {},
        't2f': {},
        't2g': {},
        't2s': {},
        't2w': {},
        'tab_width': 4,
    }

    def __init__(self, text, **config):
        self.full2short(config)
        digest_config(self, config)
        if text.find('\t') != -1:
            text = text.replace('\t', ' '*self.tab_width)
        self.text = text
        self.lsh = self.size if self.lsh == -1 else self.lsh

        file_name = self.text2svg()
        self.remove_last_M(file_name)
        SVGMobject.__init__(self, file_name, **config)
        self.apply_space_chars()

        nppc = self.n_points_per_cubic_curve
        for each in self:
            if len(each.points) == 0:
                continue
            points = each.points
            last = points[0]
            each.clear_points()
            for index, point in enumerate(points):
                each.append_points([point])
                if index != len(points) - 1 and (index + 1) % nppc == 0 and any(point != points[index+1]):
                    each.add_line_to(last)
                    last = points[index + 1]
            each.add_line_to(last)

        if self.t2c:
            self.set_color_by_t2c()
        if self.gradient:
            self.set_color_by_gradient(*self.gradient)
        if self.t2g:
            self.set_color_by_t2g()

        # anti-aliasing
        if self.height is None and self.width is None:
            self.scale(TEXT_MOB_SCALE_FACTOR)