Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 05-29-2012, 05:06 AM   #1
pirl8
Pest
pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.
 
Posts: 204
Karma: 239254
Join Date: Jan 2012
Location: Italy
Device: KT, PW3
Questions about KF8/AZW3/Mobi8 from/to conversion

Hi,
  1. I've tried to convert from AZW3 to ePub a sample downloaded from Amazon (search on amazon com kindle store "relatività esposizione divulgativa"). The sample is actually very small. It cointains some font (DejaVuSerif). When these files are estracted, they are very small too, actually much smaller than the original TTF files. And it looks like they don't work in the generates ePub. Any clue?
  2. Does the AZW3 exporter embed fonts within the generated file?
  3. It' very sad that AZW3 does not have hyphenation support jet. By the way it does support the soft hyphen (& shy; ) HTML entity (and the <wbr/> tag, too).
    I've manually patched the text around a shaped div and it works well (see the small attached sample).
    May be this is a stupid idea but... Would it be possible to create a filter to automatically add a & shy; in the right hyphen positions to the generated AZW3? The filter should parse the XHTML file, apply an hyphenation algorithm according to the language of the book just adding & shy; and the kindle would then be able to render it.
Attached Files
File Type: rar x.rar (24.5 KB, 306 views)

Last edited by pirl8; 05-29-2012 at 05:58 AM.
pirl8 is offline   Reply With Quote
Old 05-29-2012, 05:12 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: 44,540
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
1. no idea, attach the sample

2. yes

3. I have no interest in this, patches are welcome. Though calibre will never do this by default as it can lead to problems when rendering/searching for text and so on.
kovidgoyal is online now   Reply With Quote
Advert
Old 05-29-2012, 05:51 AM   #3
pirl8
Pest
pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.
 
Posts: 204
Karma: 239254
Join Date: Jan 2012
Location: Italy
Device: KT, PW3
Quote:
Originally Posted by kovidgoyal View Post
1. no idea, attach the sample
Ok. It's here.

Quote:
Though calibre will never do this by default as it can lead to problems when rendering/searching for text and so on.
Maybe not for rendering but almost certainly for searching: i didn't think about it.
Attached Files
File Type: rar sample.rar (186.7 KB, 323 views)
pirl8 is offline   Reply With Quote
Old 05-29-2012, 06:05 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: 44,540
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I converted your attachment to epub and the resulting epub had the fonts declared in page_style1.css and the font files embedded correctly.
kovidgoyal is online now   Reply With Quote
Old 05-29-2012, 06:26 AM   #5
pirl8
Pest
pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.
 
Posts: 204
Karma: 239254
Join Date: Jan 2012
Location: Italy
Device: KT, PW3
Yes, and actually the Calibre reader render those fonts correctly. There must be something wrong with my PC at home...

BTW, they are actually very small (they must be small also in the original AZW3, obviously) and Windows XP cannot open them as TTF fonts. Maybe they're coded in some strange way, stripping away most of the unused characters? They could be very useful to produce downsized eBooks.

Thank you very much.
pirl8 is offline   Reply With Quote
Advert
Old 05-29-2012, 06:33 AM   #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: 44,540
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
They are probably subsetted, do a bit of googling you will find tools that subset fonts.
kovidgoyal is online now   Reply With Quote
Old 05-29-2012, 08:48 AM   #7
pirl8
Pest
pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.
 
Posts: 204
Karma: 239254
Join Date: Jan 2012
Location: Italy
Device: KT, PW3
Did a simple search test on my x.rar sample above: it works. It seems like the kindle search algorithm is ignoring soft hyphens. Maybe soft hyphens are a bulky but viable way to have hyphenation on the kindlem, after all.

I wish I could write a plugin to implement such a feature... Where could I start?
pirl8 is offline   Reply With Quote
Old 05-29-2012, 09:58 AM   #8
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: 44,540
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You can use the tweak book framework in calibre, which can explose KF8 books into html and recompile them. Using that you can write a postprocess filetype plugin to do whatever you want to the output of the calibre conversion pipeline.
kovidgoyal is online now   Reply With Quote
Old 05-30-2012, 05:59 AM   #9
pirl8
Pest
pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.pirl8 ought to be getting tired of karma fortunes by now.
 
Posts: 204
Karma: 239254
Join Date: Jan 2012
Location: Italy
Device: KT, PW3
Ok, following your directions i've find where to start looking on calibre site.

I've never programmed Python and this could be a good opportunity to begin. I've given a quick look around and i see there are python classes for parsing (x)html and to implement hyphenation, so it shouldn't be that hard.

My idea is to do something very simple: parsing html, adding softhypens to text according to the book language, saving.

Thank you very much for Calibre. I love it.

P.S.

Is a plugin doing something similar already there so I can learn from it?

Last edited by pirl8; 05-30-2012 at 06:02 AM.
pirl8 is offline   Reply With Quote
Old 05-30-2012, 06:12 AM   #10
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: 44,540
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It might be simpler for you to just modify the code in mobi_output.py to do what you want. You can worry about creating a plugin later. See the user manual for instruction on setting up a calibre development environment.

If you want to go the plugin route look at the modify epub plugin, that should be a good starting point.
kovidgoyal is online now   Reply With Quote
Old 09-14-2015, 05:44 AM   #11
newman
homo viator
newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.
 
newman's Avatar
 
Posts: 78
Karma: 252594
Join Date: May 2010
Device: Kindle DXi with 3.4.2 firmware, Kobo Glo HD
Kovid: I found a python-pyphen package which does what's needed for hyphenation. So far it seems to me as easy as: http://pastebin.com/3tSEsD13

Where do I start? Looking at calibre/src/calibre/gui2/convert/mobi_output.py it looks to me as a building block for GUI not a part of a code meant to fiddle with ebook text. Also I guess I have to alter the text when converting to AZW3 not MOBI, right?
newman is offline   Reply With Quote
Old 09-14-2015, 06:03 AM   #12
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: 44,540
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Umm there is alreadya hyphenation plugin for calibre called Hyphenate This
kovidgoyal is online now   Reply With Quote
Old 09-14-2015, 12:01 PM   #13
newman
homo viator
newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.
 
newman's Avatar
 
Posts: 78
Karma: 252594
Join Date: May 2010
Device: Kindle DXi with 3.4.2 firmware, Kobo Glo HD
Thanks! It works.
newman is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
AZW3 format - Calibre problem deborakaye Calibre 38 01-20-2013 11:41 AM
Science Fiction Wells, H.G.: The War of the Worlds. KF8/AZW3. v1.0 2012-05-21 JSWolf Other Books 5 09-13-2012 07:43 AM
KF8 conversion error JSWolf Conversion 3 05-17-2012 10:55 AM
Calibre doesn't recognize .azw3 books Breed92014 Devices 6 04-15-2012 03:50 PM
KF8 conversion and support in Calibre? Rhialto Conversion 19 01-16-2012 06:45 PM


All times are GMT -4. The time now is 11:15 PM.


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