mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Better default font when no user font settings detected (happens on linux)
This commit is contained in:
parent
0ec844aea4
commit
bfd037120a
@ -8,7 +8,7 @@ from PyQt5.Qt import (
|
|||||||
QFileInfo, QObject, QBuffer, Qt, QStyle, QByteArray, QTranslator,
|
QFileInfo, QObject, QBuffer, Qt, QStyle, QByteArray, QTranslator,
|
||||||
QCoreApplication, QThread, QEvent, QTimer, pyqtSignal, QDateTime,
|
QCoreApplication, QThread, QEvent, QTimer, pyqtSignal, QDateTime,
|
||||||
QDesktopServices, QFileDialog, QFileIconProvider, QSettings, QIcon,
|
QDesktopServices, QFileDialog, QFileIconProvider, QSettings, QIcon,
|
||||||
QApplication, QDialog, QUrl, QFont, QFontDatabase, QLocale)
|
QApplication, QDialog, QUrl, QFont, QFontDatabase, QLocale, QFontInfo)
|
||||||
|
|
||||||
ORG_NAME = 'KovidsBrain'
|
ORG_NAME = 'KovidsBrain'
|
||||||
APP_UID = 'libprs500'
|
APP_UID = 'libprs500'
|
||||||
@ -886,7 +886,12 @@ class Application(QApplication):
|
|||||||
self.redirect_notify = True
|
self.redirect_notify = True
|
||||||
self.setup_styles(force_calibre_style)
|
self.setup_styles(force_calibre_style)
|
||||||
QApplication.__init__(self, qargs)
|
QApplication.__init__(self, qargs)
|
||||||
self.original_font = QFont(QApplication.font())
|
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)
|
||||||
if not self.using_calibre_style and self.style().objectName() == 'fusion':
|
if not self.using_calibre_style and self.style().objectName() == 'fusion':
|
||||||
# Since Qt is using the fusion style anyway, specialize it
|
# Since Qt is using the fusion style anyway, specialize it
|
||||||
self.load_calibre_style()
|
self.load_calibre_style()
|
||||||
|
@ -405,12 +405,9 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
self.changed_signal.emit()
|
self.changed_signal.emit()
|
||||||
|
|
||||||
def build_font_obj(self):
|
def build_font_obj(self):
|
||||||
font_info = self.current_font
|
font_info = qt_app.original_font if self.current_font is None else self.current_font
|
||||||
if font_info is not None:
|
|
||||||
font = QFont(*(font_info[:4]))
|
font = QFont(*(font_info[:4]))
|
||||||
font.setStretch(font_info[4])
|
font.setStretch(font_info[4])
|
||||||
else:
|
|
||||||
font = qt_app.original_font
|
|
||||||
return font
|
return font
|
||||||
|
|
||||||
def update_font_display(self):
|
def update_font_display(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user