File: _triage.py

package info (click to toggle)
python-vispy 0.15.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,868 kB
  • sloc: python: 59,799; javascript: 6,800; makefile: 69; sh: 6
file content (36 lines) | stat: -rw-r--r-- 1,124 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------

import sys

from ._vispy_fonts import _vispy_fonts
if sys.platform.startswith('linux'):
    from ._freetype import _load_glyph
    from ...ext.fontconfig import _list_fonts
elif sys.platform == 'darwin':
    from ._quartz import _load_glyph, _list_fonts
elif sys.platform.startswith('win'):
    from ._freetype import _load_glyph  # noqa, analysis:ignore
    from ._win32 import _list_fonts  # noqa, analysis:ignore
else:
    raise NotImplementedError('unknown system %s' % sys.platform)

_fonts = {}


def list_fonts():
    """List system fonts

    Returns
    -------
    fonts : list of str
        List of system fonts.
    """
    vals = _list_fonts()
    for font in _vispy_fonts:
        vals += [font] if font not in vals else []
    vals = sorted(vals, key=lambda s: s.lower())
    return vals