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 10-08-2011, 04:17 PM   #1
ndr
Junior Member
ndr began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Oct 2011
Device: Kindle
Unhappy 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>
but after conversion (to htmlz, inline) it becomes:
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>
Why the "font face" is ignored? How can I prevent this?

Thanks in advance.
ndr
ndr is offline   Reply With Quote
Old 10-08-2011, 04:40 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: 29,798
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by ndr View Post
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>
but after conversion (to htmlz, inline) it becomes:
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>
Why the "font face" is ignored? How can I prevent this?

Thanks in advance.
ndr
I don't think it is correct usage .You have 2 words font and face
Example from W3Schools
<p style="font-family:arial;color:red;font-size:20px;">A paragraph.</p>
theducks is online now   Reply With Quote
Advert
Old 10-08-2011, 05:30 PM   #3
ndr
Junior Member
ndr began at the beginning.
 
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
ndr is offline   Reply With Quote
Old 10-08-2011, 10:21 PM   #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: 43,850
Karma: 22666666
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)
kovidgoyal is offline   Reply With Quote
Old 10-09-2011, 12:51 PM   #5
ndr
Junior Member
ndr began at the beginning.
 
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
ndr is offline   Reply With Quote
Advert
Reply


Forum Jump

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


All times are GMT -4. The time now is 06:00 PM.


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