|
|
#1 |
|
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,735
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,598
Karma: 28548962
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,735
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,598
Karma: 28548962
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Looks fine to me.
|
|
|
|
|
|
#5 |
|
Enthusiast
![]() Posts: 43
Karma: 70
Join Date: Jan 2012
Location: Brazil
Device: Galaxy A16 5G
|
No news on this front? No workaround?
|
|
|
|
|
|
#6 |
|
want to learn what I want
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,679
Karma: 7908443
Join Date: Sep 2020
Device: none
|
I think I may have found something else related to the font rendering issue. I had noticed this just the other day and was reminded now upon this recent user feedback:
If I run Calibre 7.26 I get correct rendering for Arial Narrow; when running Calibre >=8, the Book Details CSS I'm using for tests won't take effect: Cal 7.26: Cal 8: https://www.mobileread.com/forums/sh...&postcount=849 https://www.mobileread.com/forums/sh...&postcount=854 So, besides the above glitch with font-weight, it seems there's an issue of font subtype not rendering correctly as well? this is the custom css I tested: Spoiler:
Last edited by Comfy.n; 10-20-2025 at 02:10 AM. |
|
|
|
|
|
#7 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,598
Karma: 28548962
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
|
|
|
|
|
#8 | |
|
want to learn what I want
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,679
Karma: 7908443
Join Date: Sep 2020
Device: none
|
Quote:
|
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| 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 |