![]() |
#1 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,720
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Fonts issue with calibre 8.0.1
Hi,
People are reporting issues with the Generate Cover plugin when upgrading to 8.0.1. Which I assume are some Qt version related issue (as nothing has been changed in my plugin). Is there a code change I need to make or is this a calibre issue to be sorted? https://www.mobileread.com/forums/sh...20#post4499620 |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,173
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
How are you selecting fonts in your plugin? There have been no font related changes in calibre code for calibre 8 so if something has changed it will be in Qt.
|
![]() |
![]() |
![]() |
#3 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,720
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
The font selection combos:
Code:
class FontFamilyModel(QAbstractListModel): def __init__(self, *args): QAbstractListModel.__init__(self, *args) from calibre.utils.fonts.scanner import font_scanner try: self.families = font_scanner.find_font_families() except: self.families = [] print('WARNING: Could not load fonts') traceback.print_exc() # Restrict to Qt families as Qt tends to crash self.font = QFont('Arial' if iswindows else 'sansserif') def rowCount(self, *args): return len(self.families) def data(self, index, role): try: family = self.families[index.row()] except: traceback.print_exc() return None if role == Qt.DisplayRole: return family if role == Qt.FontRole: # If a user chooses some non standard font as the interface font, # rendering some font names causes Qt to crash, so return what is # hopefully a "safe" font return self.font return None def index_of(self, family): return self.families.index(family.strip()) class FontComboBox(QComboBox): def __init__(self, parent): QComboBox.__init__(self, parent) self.font_family_model = FontFamilyModel() self.setModel(self.font_family_model) def select_value(self, value): idx = self.findText(value) if value else -1 self.setCurrentIndex(idx) def get_value(self): if self.currentIndex() < 0: return None return unicode(self.currentText()).strip() Code:
class TextLine(object): def __init__(self, text, font_name, font_size, bottom_margin=30, align='center'): self.text = force_unicode(text) self.bottom_margin = bottom_margin try: from qt.core import QFont, Qt except ImportError: from PyQt5.Qt import QFont, Qt self.font = QFont(font_name) if font_name else QFont() self.font.setPixelSize(font_size) self._align = {'center': Qt.AlignHCenter, 'left': Qt.AlignLeft, 'right': Qt.AlignRight}[align] |
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,173
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Looks fine to me.
|
![]() |
![]() |
![]() |
#5 |
Enthusiast
![]() Posts: 41
Karma: 70
Join Date: Jan 2012
Location: Brazil
Device: Galaxy A16 5G
|
No news on this front? No workaround?
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fonts advanced settings issue | Vetchy | Kobo Reader | 0 | 09-21-2022 09:21 AM |
Rendering issue with Calibre - all fonts italicized | thiago.eec | Calibre | 16 | 12-07-2020 12:25 PM |
Calibe issue with obfuscated fonts. | DNSB | Calibre | 4 | 10-15-2019 02:58 PM |
Embedding fonts - strange issue | sparklemotion | Amazon Kindle | 152 | 11-21-2013 08:05 PM |
Chinese fonts display issue on kindle 3 | leungss | Amazon Kindle | 2 | 10-06-2010 12:48 PM |