示例#1
0
    def __init__(self, path, point_size=DEFAULT_SIZE):
        self._id = counter_id()
        self.name = (os.path.splitext(os.path.basename(path))[0] + ' ' + str(point_size)).title()

        # print('Font.__init__', self, point_size, path)

        _orig_path = path
        if not self.dpi:
            raise Exception('Font.dpi must be set before creating fonts')

        if point_size > 28:
            print('Warning: sizes above 28 may not be supported')

        if not os.path.isfile(path):
            trypath = os.path.join(SYS_FONTS, path)
            if os.path.isfile(trypath):
                path = trypath

        rc = font_load(self, path.encode('ascii', 'ignore'), point_size, self.dpi)
        if rc:
            raise FontError('font_load returned %s' % rc)
示例#2
0
 def __init__(self, vs, fs, name=None):
     self._id = counter_id()
     self.name = name
     self.create(vs, fs)
示例#3
0
 def __init__(self, vs, fs, name=None):
     self._id = counter_id()
     self.name = name
     self.create(vs, fs)