示例#1
0
def all_fonts_map(monospaced: bool = True) -> FontMap:
    if monospaced:
        ans = fc_list(FC_DUAL) + fc_list(FC_MONO)
    else:
        # allow non-monospaced and bitmapped fonts as these are used for
        # symbol_map
        ans = fc_list(-1, True)
    return create_font_map(ans)
示例#2
0
def list_fonts():
    for fd in fc_list():
        f = fd.get('family')
        if f:
            fn = fd.get('full_name') or (f + ' ' + fd.get('style', '')).strip()
            is_mono = fd.get('spacing') in ('MONO', 'DUAL')
            yield {'family': f, 'full_name': fn, 'is_monospace': is_mono}
示例#3
0
def list_fonts() -> Generator[ListedFont, None, None]:
    for fd in fc_list():
        f = fd.get('family')
        if f and isinstance(f, str):
            fn_ = fd.get('full_name')
            if fn_:
                fn = str(fn_)
            else:
                fn = (f + ' ' + str(fd.get('style', ''))).strip()
            is_mono = fd.get('spacing') in ('MONO', 'DUAL')
            yield {'family': f, 'full_name': fn, 'postscript_name': str(fd.get('postscript_name', '')), 'is_monospace': is_mono}
示例#4
0
def all_fonts_map(monospaced=True):
    if monospaced:
        ans = fc_list(FC_DUAL) + fc_list(FC_MONO)
    else:
        ans = fc_list()
    return create_font_map(ans)
示例#5
0
def all_fonts_map(monospaced=True):
    return create_font_map(fc_list(monospaced))