def apply_font()

in augly/text/augmenters/fun_fonts.py [0:0]


    def apply_font(self, text: str, font: Union[str, dict], method: str) -> str:
        assert (
            method in Method.getall()
        ), "Expected 'method' to be a value defined in nlpaug.util.method.Method"

        if isinstance(font, str):
            return font.join(text) + font if method == Method.WORD else text + font

        if isinstance(font, dict):
            return (
                "".join([font.get(char, char) for char in text])
                if method == Method.WORD
                else font.get(text, text)
            )