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

Code before:
    Check that the creation of :class:`~.MarkupText` works::

        >>> MarkupText('The horse does not eat cucumber salad.')
        MarkupText('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,
        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,
        justify: bool = False,
        gradient: tuple | None = None,
        tab_width: int = 4,
        height: int | None = None,
        width: int | None = None,
        should_center: bool = True,
        disable_ligatures: bool = False,
        warn_missing_font: bool = True,
        **kwargs: Any,
    ):
        self.text = text
        self.line_spacing: float = 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()
                else:
                    logger.warning(f"Font {font} not in {fonts_list}.")

Review comment (suggestion):
```suggestion
        gradient: Iterable[ParsableManimColor] | None = None,
```

Code after:
    def font_list() -> list[str]:
        value: list[str] = manimpango.list_fonts()
        return value

    def __init__(
        self,
        text: str,
        fill_opacity: float = 1,
        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,
        justify: bool = False,
        gradient: Iterable[ParsableManimColor] | None = None,
        tab_width: int = 4,
        height: int | None = None,
        width: int | None = None,
        should_center: bool = True,
        disable_ligatures: bool = False,
        warn_missing_font: bool = True,
        **kwargs: Any,
    ):
        self.text = text
        self.line_spacing: float = 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()
                else:
                    logger.warning(f"Font {font} not in {fonts_list}.")
        self.font = font
        self._font_size = float(font_size)
        self.slant = slant
        self.weight = weight
        self.gradient = gradient
        self.tab_width = tab_width
        self.justify = justify

        self.original_text = text