def change_font(self, font: str):
    if ('font' not in self.config):
        self.config['font'] = {}
        log.warn('"font" prop was not present in alacritty.yml')
    fonts_file = self._resource_path('fonts')
    fonts = self._load(fonts_file)
    if (fonts is None):
        raise ConfigError(f'File "{fonts_file}" is empty')
    if ('fonts' not in fonts):
        raise ConfigError(f'No font config found in "{fonts_file}"')
    fonts = fonts['fonts']
    if (font not in fonts):
        raise ConfigError(f'Config for font "{font}" not found')
    font_types = ['normal', 'bold', 'italic']
    if isinstance(fonts[font], str):
        font_name = fonts[font]
        fonts[font] = {}
        for t in font_types:
            fonts[font][t] = font_name
    if (not isinstance(fonts[font], Mapping)):
        raise ConfigError(f'Font "{font}" has wrong format')
    for t in font_types:
        if (t not in fonts[font]):
            raise ConfigError(f'Font "{font}" does not have "{t}" property')
        if (t not in self.config['font']):
            self.config['font'][t] = {'family': 'tmp'}
        self.config['font'][t]['family'] = fonts[font][t]
    log.ok(f'Font {font} applied')
def change_font(self, font: str):
    if ('font' not in self.config):
        self.config['font'] = {}
        log.warn('"font" prop was not present in alacritty.yml')
    fonts_file = self._resource_path('fonts')
    fonts = self._load(fonts_file)
    if (fonts is None):
        raise ConfigError(f'File "{fonts_file}" is empty')
    if ('fonts' not in fonts):
        raise ConfigError(f'No font config found in "{fonts_file}"')
    fonts = fonts['fonts']
    if (font not in fonts):
        raise ConfigError(f'Config for font "{font}" not found')
    font_types = ['normal', 'bold', 'italic']
    if isinstance(fonts[font], str):
        font_name = fonts[font]
        fonts[font] = {}
        for t in font_types:
            fonts[font][t] = font_name
    if (not isinstance(fonts[font], Mapping)):
        raise ConfigError(f'Font "{font}" has wrong format')
    for t in font_types:
        if (t not in fonts[font]):
            raise ConfigError(f'Font "{font}" does not have "{t}" property')
        if (t not in self.config['font']):
            self.config['font'][t] = {'family': 'tmp'}
        self.config['font'][t]['family'] = fonts[font][t]
    log.ok(f'Font {font} applied')