def default_font(self, cache=[]): """Get the default application font Uses the value specified in the config file (all fields are optinal): ``` font: face: Inconsolata size: 13 smooth: true ``` Falling back to the default system fixed width font for unspecified or unknown values. :returns: A `editxt.datatypes.Font` instance. """ cfg = self.config["font"] key = (cfg["face"], cfg["size"], cfg["smooth"]) if not (cache and cache[0] == key): cache[:] = [key, get_font(*key)] return cache[1]
def set_editor_font(editor, name, args): font = get_font(args.face, args.size, args.smooth) setattr(editor.proxy, name, font)