allow to load .ttc fonts

Create issue
Issue #1519 new
Aiven Lebowski created an issue

formatter.img:123

instead of loading just ttf:

def _create_mac(self):
    font_map = {}
    for font_dir in (os.path.join(os.getenv('HOME'), 'Library/Fonts/'),
                      '/Library/Fonts/', '/System/Library/Fonts/'):
        font_map.update(
            ((os.path.splitext(f)[0].lower(), os.path.join(font_dir, f))
                for f in os.listdir(font_dir) if f.lower().endswith('ttf')))

check multiple extensions:

def _create_mac(self):
    font_map = {}
    for font_dir in (
        os.path.join(os.getenv('HOME'), 'Library/Fonts/'),
        '/Library/Fonts/', 
        '/System/Library/Fonts/',
    ):
        font_map.update(
            (os.path.splitext(f)[0].lower(), os.path.join(font_dir, f))
            for f in os.listdir(font_dir)
            if f.lower().endswith(('ttf', 'ttc'))
        )

Comments (0)

  1. Log in to comment