def get_monospace_font():
preferred = ['Consolas', 'DejaVu Sans Mono', 'Monospace', 'Lucida Console', 'Monaco']
for name in preferred:
font = QFont(name)
if QFontInfo(font).fixedPitch():
logger.debug('Preferred monospace font: %r', font.toString())
return font
font = QFont()
font.setStyleHint(QFont().Monospace)
font.setFamily('monospace')
logger.debug('Using fallback monospace font: %r', font.toString())
return font
评论列表
文章目录