Repository: ManimCommunity/manim
File: manim/mobject/text/text_mobject.py (Python)

Code before:

        >>> Text('The horse does not eat cucumber salad.')
        Text('The horse does not eat cucumber salad.')

    """

    @staticmethod
    @functools.cache
    def font_list() -> list[str]:
        value: list[str] = manimpango.list_fonts()
        return value

    def __init__(
        self,
        text: str,
        fill_opacity: float = 1.0,
        stroke_width: float = 0,
        color: ParsableManimColor | None = None,
        font_size: float = DEFAULT_FONT_SIZE,
        line_spacing: float = -1,
        font: str = "",
        slant: str = NORMAL,
        weight: str = NORMAL,
        t2c: dict[str, str] | None = None,
        t2f: dict[str, str] | None = None,
        t2g: dict[str, tuple] | None = None,
        t2s: dict[str, str] | None = None,
        t2w: dict[str, str] | None = None,
        gradient: tuple | None = None,
        tab_width: int = 4,
        warn_missing_font: bool = True,
        # Mobject
        height: float | None = None,
        width: float | None = None,
        should_center: bool = True,
        disable_ligatures: bool = False,
        use_svg_cache: bool = False,
        **kwargs: Any,
    ):
        self.line_spacing = line_spacing
        if font and warn_missing_font:
            fonts_list = Text.font_list()
            # handle special case of sans/sans-serif
            if font.lower() == "sans-serif":
                font = "sans"
            if font not in fonts_list:
                # check if the capitalized version is in the supported fonts
                if font.capitalize() in fonts_list:
                    font = font.capitalize()
                elif font.lower() in fonts_list:
                    font = font.lower()

Review comment (suggestion):
`t2g` stands for "text to gradient" and, as before, its values can also be typed as `Iterable[ParsableManimColor]`:
```suggestion
        t2g: dict[str, Iterable[ParsableManimColor]] | None = None,
```

Code after:
        Text('The horse does not eat cucumber salad.')

    """

    @staticmethod
    @functools.cache
    def font_list() -> list[str]:
        value: list[str] = manimpango.list_fonts()
        return value

    def __init__(
        self,
        text: str,
        fill_opacity: float = 1.0,
        stroke_width: float = 0,
        color: ParsableManimColor | None = None,
        font_size: float = DEFAULT_FONT_SIZE,
        line_spacing: float = -1,
        font: str = "",
        slant: str = NORMAL,
        weight: str = NORMAL,
        t2c: dict[str, str] | None = None,
        t2f: dict[str, str] | None = None,
        t2g: dict[str, Iterable[ParsableManimColor]] | None = None,
        t2s: dict[str, str] | None = None,
        t2w: dict[str, str] | None = None,
        gradient: Iterable[ParsableManimColor] | None = None,
        tab_width: int = 4,
        warn_missing_font: bool = True,
        # Mobject
        height: float | None = None,
        width: float | None = None,
        should_center: bool = True,
        disable_ligatures: bool = False,
        use_svg_cache: bool = False,
        **kwargs: Any,
    ):
        self.line_spacing = line_spacing
        if font and warn_missing_font:
            fonts_list = Text.font_list()
            # handle special case of sans/sans-serif
            if font.lower() == "sans-serif":
                font = "sans"
            if font not in fonts_list:
                # check if the capitalized version is in the supported fonts
                if font.capitalize() in fonts_list:
                    font = font.capitalize()
                elif font.lower() in fonts_list:
                    font = font.lower()
                elif font.title() in fonts_list:
                    font = font.title()