Beispiel #1
0
def findFontFamilies(dirnames=[]):
	filenames = getFontFilenames(dirnames)
	for filename in filenames:
		try:
			font = pyfont.Font(filename)
		except:
			continue
		style = font.style_name
		family = font.family_name

		if family not in uselessList:
			if not font.is_bold and not font.is_italic:
				_getFamily(family).regular = filename
			elif font.is_bold and font.is_italic:
				_getFamily(family).bolditalic = filename
			elif font.is_bold:
				_getFamily(family).bold = filename
			elif font.is_italic:
				_getFamily(family).italic = filename
			genericfamilyfound = False
			for generic in generics:
				if generic.memberOf(fontName=family):
					#generic_families[genericname].append(family)
					_getFamily(family).genericFontFamily = generic
					genericfamilyfound = True
					generic.append(_getFamily(family))
					break
			if not genericfamilyfound:
				kaplot.info("there is no generic family name found for font family %r," \
					" assuming it is a 'sans-serif' font" % family)
				#generic_families['sans-serif'].append(family)
				_getFamily(family).genericFontFamily = sans_serif
				sans_serif.append(_getFamily(family))

	for key, value in fontFamilies.items():
		value.end()
Beispiel #2
0
	def getItalic(self):
		if self.italicFont == None:
			self.italicFont = pyfont.Font(self.italic)
		return self.italicFont
Beispiel #3
0
	def getBold(self):
		if self.boldFont == None:
			self.boldFont = pyfont.Font(self.bold)
		return self.boldFont
Beispiel #4
0
	def getRegular(self):
		if self.regularFont == None:
			self.regularFont = pyfont.Font(self.regular)
		return self.regularFont
Beispiel #5
0
	def getBoldItalic(self):
		if self.bolditalicFont == None:
			self.bolditalicFont = pyfont.Font(self.bolditalic)
		return self.bolditalicFont