Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-04-2012, 10:44 AM   #241
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Quote:
Originally Posted by jackie_w View Post
On the few epubs I've tested to remove the inline @font-faces, they are correctly removed but a blank line remains.
That was sort of intentional - as a cop-out to making sure I made the least intrusive change to the epub possible. Right now my regex for doing the replacement ends at the closing brace }. i.e.
Code:
@font\-face[^}]+?}
I guess the question for the regex gurus is what would be a "safe" addition to that, given the permutations of how styles might be laid out in the original file. Can I get away with this for instance?
Code:
@font\-face[^}]+?}\s+
Quote:
Originally Posted by jackie_w View Post
After modifying an epub, the calibre last_modified date column does not change. Is this deliberate? It may have always worked like this but I never noticed before.
There should be nothing new about that behaviour from previous versions. I'll see if I can figure out what it is supposed to do to get that field updated.
kiwidude is offline   Reply With Quote
Old 05-04-2012, 10:55 AM   #242
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,785
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 kiwidude View Post

Finally (to anyone) - I'm thinking of adding an option to the plugin to remove line-height declarations from css files. They cause me nothing but grief - I don't understand why the publisher should dictate that particularly when it just goes badly wrong and text either appears squashed or too spaced out. Usually I manually blitz them in Sigil. I "presume" they have some purpose for some device somewhere, I guess my question is can anyone tell me what that purpose is, and whether they might find such an option useful?
For most cases removal of Line-height is OK. There are places where it would really mess things up (Usually around Dropcaps and images)
Instead of removal: simply comment the line out , leaving the value in place for a quick repair
theducks is offline   Reply With Quote
Old 05-04-2012, 11:47 AM   #243
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,208
Karma: 16534692
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by kiwidude View Post
I guess the question for the regex gurus is what would be a "safe" addition to that, given the permutations of how styles might be laid out in the original file. Can I get away with this for instance?
Code:
@font\-face[^}]+?}\s+
I'm not a guru either, but the addition of the \s+ LOOKS harmless. If \s only matches space, tab, newline then it shouldn't remove anything vital

What could possibly go wrong?

Another opinion re: line-height...
I only zap some occurrences (manually, of course), those which affect main body text. I've had problems with long chapter headings if the font is large and the line-height isn't set to 1.3 or higher. Also in agreement about Dropcaps. If the setting isn't 'just right' for your chosen font, it can look terrible. Difficult to achieve a 'perfect' result automatically, I think. I don't suppose most people are this obsessive, though.
jackie_w is offline   Reply With Quote
Old 05-04-2012, 12:25 PM   #244
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,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You want \s* not \s+
kovidgoyal is offline   Reply With Quote
Old 05-04-2012, 12:40 PM   #245
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Thx Kovid, good spot.

Re the line-height/dropcaps thing. I've not got a lot of love for dropcaps . Probably because I don't believe my Kindle supports them, and I also don't think that webkit/Sigil or whatever renders them "properly" either. So I personally have no issue of obliterating the "drop" by removing the line height and turning it into a large first letter.

I can appreciate however if you wanted to keep them then fair enough you would not want to run this option. What I had more in mind was some of those really nasty pdf scans into rtf which have hundreds of styles (and certainly nothing as fancy as drop-caps!). Maybe this is the wrong solution for that and I should just stick to Sigil regexes.
kiwidude is offline   Reply With Quote
Old 05-04-2012, 01:12 PM   #246
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,785
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 kiwidude View Post
Thx Kovid, good spot.

Re the line-height/dropcaps thing. I've not got a lot of love for dropcaps . Probably because I don't believe my Kindle supports them, and I also don't think that webkit/Sigil or whatever renders them "properly" either. So I personally have no issue of obliterating the "drop" by removing the line height and turning it into a large first letter.

I can appreciate however if you wanted to keep them then fair enough you would not want to run this option. What I had more in mind was some of those really nasty pdf scans into rtf which have hundreds of styles (and certainly nothing as fancy as drop-caps!). Maybe this is the wrong solution for that and I should just stick to Sigil regexes.
Usually there is only 1 dropcap style, so how about this idea:
A user configurable count threshold before removal/disabling
theducks is offline   Reply With Quote
Old 05-04-2012, 02:59 PM   #247
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by jackie_w View Post
...and I hope kiwidude ignores your request. Why are you constantly banging on about this, insisting that everyone else should want to see covers the way you want them? Surely the idea of using every user's personal calibre default for cover aspect ratio should keep everyone happy.
If you bought a pBook that has the cover looking off, would you be happy with it? eBook, same thing (IMHO).
JSWolf is offline   Reply With Quote
Old 05-04-2012, 03:01 PM   #248
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by theducks View Post
For most cases removal of Line-height is OK. There are places where it would really mess things up (Usually around Dropcaps and images)
Instead of removal: simply comment the line out , leaving the value in place for a quick repair
I was going to say something similar but you beat me to it. I have to agree that removing all line height can possibly cause some problems.
JSWolf is offline   Reply With Quote
Old 05-04-2012, 03:04 PM   #249
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by kiwidude View Post
Thx Kovid, good spot.

Re the line-height/dropcaps thing. I've not got a lot of love for dropcaps . Probably because I don't believe my Kindle supports them, and I also don't think that webkit/Sigil or whatever renders them "properly" either. So I personally have no issue of obliterating the "drop" by removing the line height and turning it into a large first letter.
Even if you turn a dropcap into a large first letter, you still need a line-height of 0 to keep that first line of the paragraph to not have extra space between it and the second line.
JSWolf is offline   Reply With Quote
Old 05-04-2012, 03:59 PM   #250
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Quote:
Originally Posted by JSWolf View Post
Even if you turn a dropcap into a large first letter, you still need a line-height of 0 to keep that first line of the paragraph to not have extra space between it and the second line.
True. But compared to a first letter which floats in the middle of nowhere I can live with that .

I've dropped the idea as I said above. In an ideal world it would really be a Sigil plugin if it supported such things, that way you could more easily have the fine control if you wanted it.
kiwidude is offline   Reply With Quote
Old 05-04-2012, 04:38 PM   #251
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,208
Karma: 16534692
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by JSWolf View Post
If you bought a pBook that has the cover looking off, would you be happy with it? eBook, same thing (IMHO).
Well, I'd certainly be unhappy if I bought a pbook with 2 great black (or white) bars down the sides, which is what you're advocating we all should want for our ebooks.

Anyway, we'll never agree on this, let's just leave it
jackie_w is offline   Reply With Quote
Old 05-04-2012, 04:52 PM   #252
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by jackie_w View Post
Well, I'd certainly be unhappy if I bought a pbook with 2 great black (or white) bars down the sides, which is what you're advocating we all should want for our ebooks.

Anyway, we'll never agree on this, let's just leave it
But in this case, they are grey stripes. Personally, I do prefer seeing the cover image look the way it's meant to look. I find that if I notice that the aspect ratio is wrong, it ruins the look of the cover for me. It is akin to stretching a 4:3 TV picture to fit a 16:9 screen.
JSWolf is offline   Reply With Quote
Old 05-04-2012, 10:47 PM   #253
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,785
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 JSWolf View Post
But in this case, they are grey stripes. Personally, I do prefer seeing the cover image look the way it's meant to look. I find that if I notice that the aspect ratio is wrong, it ruins the look of the cover for me. It is akin to stretching a 4:3 TV picture to fit a 16:9 screen.
Streach-o-vision.
Bleah
You might as well watch that movie on a phone

Pan and scan is not much better. P&S absolutely ruined the keys scene in ET
theducks is offline   Reply With Quote
Old 05-15-2012, 12:20 PM   #254
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
@Kovid - I've spent a number of hours looking into the conversion pipeline in relation to covers... and my head hurts

In particular - the epub_input.py plugin does some "fiddling" to generate a calibre_raster_cover.jpg and associated entries in the manifest along with a "titlepage" entry in the guide. However by the time it gets to the "structure" part of the pipeline, that seems to have magically disappeared and other logic from somewhere has come into play. Whats that all about - I "assume" it isn't just legacy code and actually has a scenario where it makes sense? Perhaps for non epub output or something?

I've found CoverManager being invoked by the epub_output.py plugin at the end, but I'm trying to figure out "what else" is taking place of relevance to covers in between during a conversion. Any other hints you can offer to look at?
kiwidude is offline   Reply With Quote
Old 05-15-2012, 01:19 PM   #255
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,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I'm afraid I dont keep the details of cover handling in my head. I'd have to trawl through the code myself. IIRC the idea is that epub input creates a raster cover and a reference to the html cover (removing it from the spine), if the html cover is defined in the metadata. The rest of the conversion pipeline does nothing with covers, the various output plugins either use the raster cover, or for epub output do something complicated like replacing the html cover or adding one depending on the cover situation in the input document.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Any web-to-epub plugin for internet browser? bthoven ePub 7 07-10-2011 05:14 AM
[Old Thread] Reading epub on viewer inexplicably changes the time stamp of epub greenapple Library Management 20 03-19-2011 10:18 PM
Easy way to modify thread subscription emails in bulk? snipenekkid Feedback 11 02-06-2011 03:47 AM
Another plugin dev question DiapDealer Plugins 2 12-11-2010 01:46 PM
Epub plugin dev DiapDealer Plugins 15 11-12-2010 09:36 AM


All times are GMT -4. The time now is 02:22 AM.


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