10-08-2011, 04:17 PM | #1 |
Junior Member
Posts: 4
Karma: 10
Join Date: Oct 2011
Device: Kindle
|
Problem with calibre ignoring font styles
Hi, I'm having issues converting mobi file to another format. I can't make calibre to retain font styles.
I've enabled the debug mode, and the input file looks like this: Code:
<p class="calibre_53"><font face="Times New Roman" color="gray"><span class="bold">Text1</span></font></p> <p class="calibre_137"><font face="sans-serif">Text2</font></p> Code:
<p style="display: block; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 15%; text-indent: 1em"><span style="color: gray"><span style="font-weight: bold">Text1</span> </span></p> <p style="display: block; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 1%; text-align: center; text-indent: 0"><span>Text2</span></p> Thanks in advance. ndr |
10-08-2011, 04:40 PM | #2 | |
Well trained by Cats
Posts: 30,421
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Example from W3Schools <p style="font-family:arial;color:red;font-size:20px;">A paragraph.</p> |
|
Advert | |
|
10-08-2011, 05:30 PM | #3 |
Junior Member
Posts: 4
Karma: 10
Join Date: Oct 2011
Device: Kindle
|
No, the <font/> tag is actually a legal element of HTML spec.
Besides it's not the original file but the result of parsing of the mobi file by calibre (saved in the input folder when in debug mode). The problem is that while the "color" attribute is recognized and converted to its css equivalent (<span style="color: gray">) the "face" attribute is skipped. My question is, why it's not converted as well (to <span style="font-family:sans-serif"> or similar)? ndr |
10-08-2011, 10:21 PM | #4 |
creator of calibre
Posts: 44,428
Karma: 24044628
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
MOBI does not support font embedding and as such using font-family (or <font face> is extremely fragile since what effects it has depends on what fonts are installed on the users system and what reading application the user is using. As such, I have never felt the need (nor has anyone before you requested) support for <font face>.
But it should be a trivial feature to add, open a bug report for it, so i dont forget (I am currently traveling) |
10-09-2011, 12:51 PM | #5 |
Junior Member
Posts: 4
Karma: 10
Join Date: Oct 2011
Device: Kindle
|
Thanks a lot! I'll do that.
As for the reason, having a book in which different parts of text are distinguished using typeface (instead of bold or italic), it would be desirable to maintain such formatting style during conversion. I can always replace "Times New Roman" with a more generic class (or embed that specific font in case of epub output), as long as such information is preserved. But it would be very hard to recreate it if it's lost after conversion. ndr |
Advert | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre and Sigil styles | LGN | Sigil | 5 | 01-29-2011 02:17 AM |
Calibre ignoring default output format | flinx1 | Calibre | 8 | 05-01-2010 09:12 PM |
Changing default font styles and sizes | p3aul | Calibre | 26 | 07-12-2009 01:40 AM |
Combining font styles into single ttf file | sherman | Sony Reader Dev Corner | 4 | 04-24-2009 09:21 PM |