本文整理匯總了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)