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)
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}
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}
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)
def all_fonts_map(monospaced=True): return create_font_map(fc_list(monospaced))