本文整理汇总了Python中PyQt4.Qt.QFontDatabase.addApplicationFont方法的典型用法代码示例。如果您正苦于以下问题:Python QFontDatabase.addApplicationFont方法的具体用法?Python QFontDatabase.addApplicationFont怎么用?Python QFontDatabase.addApplicationFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QFontDatabase
的用法示例。
在下文中一共展示了QFontDatabase.addApplicationFont方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_builtin_fonts
# 需要导入模块: from PyQt4.Qt import QFontDatabase [as 别名]
# 或者: from PyQt4.Qt.QFontDatabase import addApplicationFont [as 别名]
def load_builtin_fonts():
import glob
from PyQt4.Qt import QFontDatabase
base = P('fonts/liberation/*.ttf')
for f in glob.glob(base):
QFontDatabase.addApplicationFont(f)
return 'Liberation Serif', 'Liberation Sans', 'Liberation Mono'
示例2: rating_font
# 需要导入模块: from PyQt4.Qt import QFontDatabase [as 别名]
# 或者: from PyQt4.Qt.QFontDatabase import addApplicationFont [as 别名]
def rating_font():
global _rating_font
if _rating_font is None:
from PyQt4.Qt import QFontDatabase
_rating_font = 'Arial Unicode MS' if iswindows else 'sans-serif'
fontid = QFontDatabase.addApplicationFont(
#P('fonts/liberation/LiberationSerif-Regular.ttf')
P('fonts/calibreSymbols.otf')
)
if fontid > -1:
try:
_rating_font = unicode(list(
QFontDatabase.applicationFontFamilies(fontid))[0])
except:
pass
return _rating_font
示例3: initialiseFonts
# 需要导入模块: from PyQt4.Qt import QFontDatabase [as 别名]
# 或者: from PyQt4.Qt.QFontDatabase import addApplicationFont [as 别名]
def initialiseFonts():
fonts = [("NotCourierSans", "ncs.otf"),
('Inconsolata', 'inconsolata.otf'),
('BPmono', 'bpmono.ttf'),
('Liberation Mono', 'liberation.otf'),
('Oxygen Mono', 'oxygen.otf'),
('Open Sans', 'opensans.ttf'),
('Montserrat', 'montserrat.ttf'),
('Noto Sans', 'notosans.ttf'),
('PT Sans', 'ptsans.ttf'),
('Raleway', 'roboto.ttf'),
('Roboto', 'raleway.ttf')]
for fontName, fontFile in fonts:
if QFontDatabase.addApplicationFont(":/fonts/" + fontFile) == -1:
print fontName
else:
font = QFont(fontName)
Data.FontOptions.FontOptions.addFont(fontName, font)
Data.FontOptions.FontOptions.addFont(fontName, font)