05-29-2012, 05:06 AM | #1 |
Pest
Posts: 204
Karma: 239254
Join Date: Jan 2012
Location: Italy
Device: KT, PW3
|
Questions about KF8/AZW3/Mobi8 from/to conversion
Hi,
Last edited by pirl8; 05-29-2012 at 05:58 AM. |
05-29-2012, 05:12 AM | #2 |
creator of calibre
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. |
Advert | |
|
05-29-2012, 05:51 AM | #3 | |
Pest
Posts: 204
Karma: 239254
Join Date: Jan 2012
Location: Italy
Device: KT, PW3
|
Ok. It's here.
Quote:
|
|
05-29-2012, 06:05 AM | #4 |
creator of calibre
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.
|
05-29-2012, 06:26 AM | #5 |
Pest
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. |
Advert | |
|
05-29-2012, 06:33 AM | #6 |
creator of calibre
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.
|
05-29-2012, 08:48 AM | #7 |
Pest
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? |
05-29-2012, 09:58 AM | #8 |
creator of calibre
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.
|
05-30-2012, 05:59 AM | #9 |
Pest
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. |
05-30-2012, 06:12 AM | #10 |
creator of calibre
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. |
09-14-2015, 05:44 AM | #11 |
homo viator
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? |
09-14-2015, 06:03 AM | #12 |
creator of calibre
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
|
09-14-2015, 12:01 PM | #13 |
homo viator
Posts: 78
Karma: 252594
Join Date: May 2010
Device: Kindle DXi with 3.4.2 firmware, Kobo Glo HD
|
Thanks! It works.
|
|
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 |