コード例 #1
0
ファイル: application.py プロジェクト: editxt/editxt
    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]
コード例 #2
0
ファイル: commands.py プロジェクト: editxt/editxt
def set_editor_font(editor, name, args):
    font = get_font(args.face, args.size, args.smooth)
    setattr(editor.proxy, name, font)