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 01-08-2024, 04:34 AM   #1
feuille
Connoisseur
feuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enough
 
Posts: 52
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
QFont attributes

Is there a way to set the font styles in Calibre regardless of the environment?

I tried with:
Code:
font = QFont()
font.setStyleHint(QFont.SansSerif)
font.setFamily('Arial') # Windows
#font.setFamily('Helvetica') # Linux
as described in the Qt documentation.
But I get the error message "'QFont' object has no attribute 'SansSerif'". The same applies to QFont.Serif, QFont.TypeWriter, etc.

I suspect this is because Calibre uses its own abstraction for Qt.
feuille is offline   Reply With Quote
Old 01-08-2024, 05:55 AM   #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: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No this has nothing to do with calibre. You need to use the full enum name. QFont.StyleHint.Whatever
kovidgoyal is offline   Reply With Quote
Old 01-08-2024, 01:17 PM   #3
feuille
Connoisseur
feuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enough
 
Posts: 52
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
Thanks!

Quote:
Originally Posted by kovidgoyal View Post
No this has nothing to do with calibre. You need to use the full enum name. QFont.StyleHint.Whatever
Thanks, Kovid, for the quick solution, as always.
feuille is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
tag attributes in random order guich Sigil 6 11-14-2019 09:06 AM
adding language attributes roger64 ePub 1 02-07-2017 12:29 PM
How do I create a recipe for content with these attributes anleva Recipes 7 10-21-2016 09:45 AM
Remove unused class attributes phossler Editor 15 01-26-2016 01:06 PM
What are DR1000 friendly pdf attributes, if there are any? sarikan iRex 4 12-29-2008 11:31 AM


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


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