Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 03-23-2025, 09:13 PM   #1
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
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
kiwidude is offline   Reply With Quote
Old 03-23-2025, 10:21 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,594
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.
kovidgoyal is online now   Reply With Quote
Old 03-23-2025, 11:44 PM   #3
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
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()
Then the code for drawing making use of the font...
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]
kiwidude is offline   Reply With Quote
Old 03-24-2025, 01:11 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,594
Karma: 28548962
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Looks fine to me.
kovidgoyal is online now   Reply With Quote
Old 03-31-2025, 01:18 PM   #5
MCBastos
Enthusiast
MCBastos is on a distinguished road
 
Posts: 43
Karma: 70
Join Date: Jan 2012
Location: Brazil
Device: Galaxy A16 5G
No news on this front? No workaround?
MCBastos is offline   Reply With Quote
Old Yesterday, 02:07 AM   #6
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
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:

Click image for larger version

Name:	2025-10-20 02_47_27-calibre — __ Calibre Library __.png
Views:	10
Size:	152.1 KB
ID:	218740

Cal 8:

Click image for larger version

Name:	2025-10-20 02_51_21-calibre — __ Calibre Library __.png
Views:	8
Size:	143.7 KB
ID:	218739


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:

table.fields td.title {color: #b4b5b5; text-align: right; font-size:11px;line-height: 1.1; }

#author, #author a {color:#F578BE; font-family:arial narrow!important;font-weight: bold;}

#_bio div {margin-left: -30px !important; }

/*#_bio table, #_bio td{border: 1px solid red !important;transform-origin: center !important;
transform: scale(0.5) !important;}*/

#_comments2{font-size: 11px !important; }

#_tt, #_tt a {color:#fbff17 !important; font-weight: bold;}

#title_sort{font-size: 11px !important; font-weight: bold; }

#title_sort a {font-family:LexiaDama !important;color:#fbff17 !important; }

#author_sort{font-size: 11px !important; font-weight: bold;}

#author_sort a {color:orange; font-weight: bold; font-family:arial narrow!important;}


#title { /* font-size: 12px !important;*/
color:#fbff17 !important; font-weight: bold; }

#comments {color:aqua; font-weight: bold; font-family:arial narrow!important;}

#rating, #rating a, #identifiers, #identifiers a {font-size: 11px;}

#tags, #tags a {color:#F578BE; font-family:arial narrow!important;font-weight: bold;}

#_tr, #_tr a, #_subtitle, #_subtitle a {
color:lime; /* font-weight: bold;*/}

#_ot, #_ot a {color:lime; /* font-weight: bold;*/}

#_rgstatus a {color:#ffff91; /* font-weight: bold;*/}

#timestamp a, #path a{/*color:orange;*/
font-weight: bold;}

#formats {/*color:orange;*/ font-weight: bold; font-size: 11px !important;}

#_f {/*color:orange;*/ /*font-weight: bold; */ font-size: 10px !important;}

#_as2 a {color:orange; font-weight: bold; font-family:arial narrow!important;}


body, td {background-color: transparent;}

body.horizontal table td.title { white-space: nowrap }

table.aaa { margin-left: -15; }

a { text-decoration: none;}

.comments { margin-top: 0; padding-top: 0; text-indent: 0;}



.comments-heading { font-size: larger;
font-weight: bold}

table.fields { margin-bottom: 0; padding-bottom: 0;}

table.fields td { vertical-align: top}

table.fields td.title { font-weight: bold}

.series_name { font-style: italic}

/*
The HTML that this stylesheet applies to looks like this:

<table class="fields">
<tr id="formats" class="datatype_text"><td class="title">Formats:</td><td><a href="format:572:EPUB">EPUB</a>, <a href="format:572:LIT">LIT</a></td></tr>
<tr id="series" class="datatype_series"><td class="title">Series:</td><td>Book II of <a href="..."><span class="series_name">The Sea Beggars</span></a></td></tr>
<tr id="tags" class="datatype_text"><td class="title">Tags:</td><td><a href="...">Fantasy</a>, <a href="...">Fiction</a></td></tr>
<tr id="path" class="datatype_text"><td class="title">Path:</td><td><a href="path:572" title="/home/kovid/test library/Paul Kearney/This Forsaken Earth (572)">Click to open</a></td></tr>
</table>

<div id="comments" class="comments"><h3>From Publishers Weekly</h3><p>At the start of Kearney's rousing sequel to <em>The Mark of Ran</em> (2005), Rol Cortishane, the youthful captain of the privateer <em>Revenant</em>, captures a slaver and frees its chained slaves. Back in the harbor of Ganesh Ka in the land of Umer, Rol encounters an untrustworthy acquaintance he hasn't seen in years, Canker, a former king of thieves, who urges Rol to join in the fight to save Rowen, a darkly beautiful queen, whose throne is at risk in mountainous Bionar. That Rowen is Rol's half-sister for whom he has lusted in the past doesn't make Rol's decision to help an easy one. If as in <em>The Mark of Ran</em> the action is more lively at sea than on land, Kearney's solid storytelling and nautical detail worthy of C.S. Forester or Patrick O'Brian will keep readers turning the pages. <em>(Dec.)</em> <br />Copyright © Reed Business Information, a division of Reed Elsevier Inc. All rights reserved. </p><h3>From</h3><p>The sequel to <em>The Mark of Ran</em> (2005) finds heroic young Rol Cortishane grown to be a much-feared sea captain. Deciding to ignore his mysterious past, he spends his energy on ship and crew. He is still an outlaw, however, and the only port he can call home is Ganesh Ka, the endangered city of exiles. When word comes from Rowan, his half-sister, asking him to fight on her behalf, he must weigh the safety of Ganesh Ka against Rowan's treachery in the past. Finally persuaded to aid Rowan, he learns more of betrayal and his heritage in the ensuing battles than he had wanted to know. Kearney's characters are much better developed here than they were in <em>The Mark of Ran</em>, and since the book tells a single story, the plot is tighter. Moreover, because almost all the action transpires in the here and now, the sequel can be read without reference to the predecessor. Since it ends hanging on a particularly bloody cliff, expect to see more of Kearney's excellent maritime fantasy. <em>Frieda Murray</em><br /><em>Copyright © American Library Association. All rights reserved</em></p>
</div>

<h3 class="comments-heading">Custom comments column heading</h3>
<div id="_customcolname" class="comments">...</div>
*/

Last edited by Comfy.n; Yesterday at 02:10 AM.
Comfy.n is offline   Reply With Quote
Old Yesterday, 03:53 AM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,594
Karma: 28548962
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://bugreports.qt.io/browse/QTBUG-135817
kovidgoyal is online now   Reply With Quote
Old Yesterday, 04:25 AM   #8
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,679
Karma: 7908443
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by kovidgoyal View Post
Comfy.n is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 01:26 PM.


MobileRead.com is a privately owned, operated and funded community.