Skip to content

allow to load .ttc fonts #1223

@Anteru

Description

@Anteru

(Original issue 1519 created by vanyakosmos on 2019-06-01T18:04:00.912951+00:00)

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'))
        )

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-formattingarea: changes to formattersS-minorseverity: minorT-featuretype: a new featureX-importedimported from Bitbucket

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions