mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Change default font on windows to Segoe UI 9pt as recommended by Microsoft. MS Shell Dlg 2 does not render well on hidpi displays
This commit is contained in:
parent
3c9f17bd2b
commit
eda1926d58
@ -988,12 +988,7 @@ class Application(QApplication):
|
||||
if islinux or isbsd:
|
||||
self.setAttribute(Qt.AA_DontUseNativeMenuBar, 'CALIBRE_NO_NATIVE_MENUBAR' in os.environ)
|
||||
self.setup_styles(force_calibre_style)
|
||||
f = QFont(QApplication.font())
|
||||
if (f.family(), f.pointSize()) == ('Sans Serif', 9): # Hard coded Qt settings, no user preference detected
|
||||
f.setPointSize(10)
|
||||
QApplication.setFont(f)
|
||||
f = QFontInfo(f)
|
||||
self.original_font = (f.family(), f.pointSize(), f.weight(), f.italic(), 100)
|
||||
self.setup_ui_font()
|
||||
if not self.using_calibre_style and self.style().objectName() == 'fusion':
|
||||
# Since Qt is using the fusion style anyway, specialize it
|
||||
self.load_calibre_style()
|
||||
@ -1045,6 +1040,23 @@ class Application(QApplication):
|
||||
# Qt 5 bug: https://bugreports.qt-project.org/browse/QTBUG-41125
|
||||
self.aboutToQuit.connect(self.flush_clipboard)
|
||||
|
||||
def setup_ui_font(self):
|
||||
f = QFont(QApplication.font())
|
||||
q = (f.family(), f.pointSize())
|
||||
if iswindows:
|
||||
if q == ('MS Shell Dlg 2', 8): # Qt default setting
|
||||
# Microsoft recommends the default font be Segoe UI at 9 pt
|
||||
# https://msdn.microsoft.com/en-us/library/windows/desktop/dn742483(v=vs.85).aspx
|
||||
f.setFamily('Segoe UI')
|
||||
f.setPointSize(9)
|
||||
QApplication.setFont(f)
|
||||
else:
|
||||
if q == ('Sans Serif', 9): # Hard coded Qt settings, no user preference detected
|
||||
f.setPointSize(10)
|
||||
QApplication.setFont(f)
|
||||
f = QFontInfo(f)
|
||||
self.original_font = (f.family(), f.pointSize(), f.weight(), f.italic(), 100)
|
||||
|
||||
def flush_clipboard(self):
|
||||
try:
|
||||
if self.clipboard().ownsClipboard():
|
||||
|
Loading…
x
Reference in New Issue
Block a user