Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 04-20-2019, 02:58 PM   #1
JonnieCache
Junior Member
JonnieCache began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Apr 2019
Device: Kindle Oasis, iPad Pro
How to Modify @font-face on Conversion?

Is there a way to modify the @font-face in CSS files that already exist in a given book so that it is modified during conversion?

For example, I want to convert:

@font-face {
font-family: Hlv
}

to

@font-face {
font-family: Helvetica
}

during conversion so that it will reference the fonts correctly using the correct name of the font. Using style transformation, transformation doesn't affect font-family under @font-face in a given CSS file, but it will affect the rest of the references to the font-family in the same CSS file.
JonnieCache is offline   Reply With Quote
Old 04-20-2019, 03:17 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,950
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Why fight it doing a conversion?
Open the editor and fix it (saved search if repetitive)
theducks is offline   Reply With Quote
Advert
Old 04-20-2019, 03:27 PM   #3
JonnieCache
Junior Member
JonnieCache began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Apr 2019
Device: Kindle Oasis, iPad Pro
Quote:
Originally Posted by theducks View Post
Why fight it doing a conversion?
Open the editor and fix it (saved search if repetitive)
Because I want to do it for ~450 books.

And because I'd like to set it up to automate for future books.

Last edited by JonnieCache; 04-20-2019 at 03:32 PM.
JonnieCache is offline   Reply With Quote
Old 04-21-2019, 02:42 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,256
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You can use the Transform styling tool to adjust CSS properties, should work for the "font-family" property in @font-face rules as well, though I have not tested. See the Look & feel section of the conversion dialog.
kovidgoyal is online now   Reply With Quote
Old 04-21-2019, 01:27 PM   #5
JonnieCache
Junior Member
JonnieCache began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Apr 2019
Device: Kindle Oasis, iPad Pro
Quote:
Originally Posted by kovidgoyal View Post
You can use the Transform styling tool to adjust CSS properties, should work for the "font-family" property in @font-face rules as well, though I have not tested. See the Look & feel section of the conversion dialog.
Thanks for the reply, Kovid! I'm so happy you responded personally! I really appreciate it! I've donated in the past, but I just donated some more. I really LOVE the software. Keep up the great work!

I thought that the transform styling tool should work for that purpose. But when it didn't work, I thought perhaps @font-face rules were deliberately excluded for some (technical?) reason. So, it seems this may just be a bug in the conversion process when Calibre applies the transform rules.

Here is a screenshot of some of the transform rules that I've set up:

Click image for larger version

Name:	Screen Shot 2019-04-21 at 11.26.41 AM.png
Views:	136
Size:	888.4 KB
ID:	170833

Here are a couple screenshots of the original eBook CSS before conversion:

Click image for larger version

Name:	Screen Shot 2019-04-21 at 11.30.22 AM.png
Views:	134
Size:	916.3 KB
ID:	170835
Click image for larger version

Name:	Screen Shot 2019-04-21 at 11.25.47 AM.jpg
Views:	122
Size:	533.5 KB
ID:	170834

Then after conversion, here are a couple of screenshots. You can see that the @font-face rules were not transformed.

Click image for larger version

Name:	Screen Shot 2019-04-21 at 11.27.39 AM.jpg
Views:	129
Size:	509.8 KB
ID:	170836
Click image for larger version

Name:	Screen Shot 2019-04-21 at 11.27.49 AM.jpg
Views:	162
Size:	494.2 KB
ID:	170837

I would like to embed the fonts in all of my EPUBs if they aren't included already. Although I realize this increases the size of the books, I would like to view the books as they were intended by the author/publisher.

I'm not a font expert, but as I understand it, the problem with the embedding process is due to how different platforms (macOS, Windows, Linux) refer to the fonts and also differences between identification of .TTF and .OTF versions of the same font across the platforms. In the CSS, the font may be listed as "AJensonPro-Lt" (from Windows?), but macOS sees it as "Adobe Jenson Pro Lt". So, when Calibre tries to embed the font, it doesn't see the font from macOS as it is listed in the CSS.

I realize that this may be a big undertaking, but font substitution would be a cool feature to add. That way, the user could set up the fonts to substitute, not only for editing, but also for previews and the E-Book Viewer. I wish the OSs would support font substitution natively and allow users to tweak them.

Let me know your thoughts..

Thank you in advance!

Jonathan

Last edited by JonnieCache; 04-21-2019 at 03:21 PM.
JonnieCache is offline   Reply With Quote
Advert
Old 04-21-2019, 09:46 PM   #6
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,256
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Open a bug report and I will look into extending the transform styling tool to also work with properties in @-rules.
kovidgoyal is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Suppressing font-face declarations roger64 Editor 2 09-26-2017 05:46 AM
@font-face is not embedded iliakan Conversion 2 01-12-2015 02:29 AM
Modify font sizes? sneakyspider Kindle Developer's Corner 3 05-10-2013 03:52 PM
Am I using @font-face correctly? phossler Sigil 12 11-30-2012 04:38 PM
Trying to modify conversion parameters Terisa de morgan Conversion 2 11-28-2012 12:35 AM


All times are GMT -4. The time now is 07:13 AM.


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