コード例 #1
0
ファイル: ttffiles.py プロジェクト: 7o9/stdm-plugin
    def fontMembers( self, fontName, weight=None, italics=None ):
        """Get specific font names for given generic font name

        weight -- if specified, only members with the given weight
        italics -- if specified, only members where the flag matches

        returns list of specific font names
        """
        table = self.fonts.get( fontName, {})
        items = table.items()
        items.sort()
        if weight is not None:
            weight = describe.weightNumber( weight )
            items = [item for item in items if item[0][0]==weight]
        if italics is not None:
            items = [item for item in items if item[0][1]==italics]
        result = []
        for item in items:
            result.extend( item[1])
        return result
コード例 #2
0
    def fontMembers(self, fontName, weight=None, italics=None):
        """Get specific font names for given generic font name

        weight -- if specified, only members with the given weight
        italics -- if specified, only members where the flag matches

        returns list of specific font names
        """
        table = self.fonts.get(fontName, {})
        items = list(table.items())
        items.sort()
        if weight is not None:
            weight = describe.weightNumber(weight)
            items = [item for item in items if item[0][0] == weight]
        if italics is not None:
            items = [item for item in items if item[0][1] == italics]
        result = []
        for item in items:
            result.extend(item[1])
        return result