Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 03-31-2017, 06:47 AM   #61
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,987
Karma: 128903378
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 Rev. Bob View Post
It's in the editor's CSS filtering command, which I tried out yesterday. After looking at a random chapter in the book to find a standard body-text class, I went into the stylesheet to see what the associated font size was - in this case, 0.83em. Then I opened the filter dialog, which lets you specify a CSS property, value ranges, and what to do with whatever matches the spec. I selected font-size, any value, Multiply by, and whatever the reciprocal of 0.83 is. (In retrospect, I should've just said Divide by 0.83. Same effect.) Push the button, and off it goes!
Thanks. That really helps.

Quote:
It won't correct for situations where, for instance, vertical margins are set to interact with the text size to produce a specific result (such as using a 1.33em margin with 0.75em text to get a 1em gap) - but hey, it saved me from a lot of manual calculations. Granted, I still went through the stylesheet and performed some smart truncation - such as changing 1.000001em to remove the fraction - but that's just me being fiddly.
That's just whoever made the eBook being sloppy.
JSWolf is offline   Reply With Quote
Old 03-31-2017, 08:46 AM   #62
Rev. Bob
Wizard
Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.
 
Rev. Bob's Avatar
 
Posts: 1,760
Karma: 9918418
Join Date: Feb 2013
Location: Here on the perimeter, there are no stars
Device: Kobo H2O, iPad mini 3, Kindle Touch
Quote:
Originally Posted by JSWolf View Post
What font sizes are <small> , <large>, <x-small>, etc. in em?
Completely platform-dependent. W3C originally recommended a 1.5x factor between each step in CSS1, then changed their mind and decided 1.2x was better in CSS2, and is now rethinking it yet again. That said, their new table translates to:

H6/xx-small: 0.6em
x-small: 0.75em
H5/small: 0.89em (8/9)
H3/large: 1.2em
H2/x-large: 1.5em
H1/xx-large: 2em

Just don't expect to see that etched in stone anywhere. It's a suggestion, not a set of ironclad rules, and implementations will differ.

Quote:
Originally Posted by JSWolf View Post
That's just whoever made the eBook being sloppy.
No, that's called paying attention to detail. If you want exactly 1em (absolute) of space between lines that are not 1em tall, you have to set the appropriate vertical margin to the reciprocal of the active font size. Simply saying "margin-top: 1em" won't do it; that 1em is relative to the element's current size, not an absolute value.

In other words, the H2 element traditionally carries a 1em (relative) top and bottom margin. If it also carries the 1.5em (absolute) font size listed above, then the gap between two consecutive H2 elements will be 1.5em (absolute) - translating to "skip a line between H2 elements."

Thus, if you want an actual 1em (absolute) space between those elements, you have to tinker with the margins by setting them to 0.6667em (relative). That way, 0.6667 x 1.5 = 1, and you get what you're after: a gap the size of a line of standard body text.

Last edited by Rev. Bob; 03-31-2017 at 08:48 AM.
Rev. Bob is offline   Reply With Quote
Advert
Old 03-31-2017, 10:44 AM   #63
dickloraine
Guru
dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.dickloraine ought to be getting tired of karma fortunes by now.
 
Posts: 631
Karma: 7544080
Join Date: Apr 2013
Location: Berlin
Device: PRS 350, Kobo Aura
If the original poster is still looking for a solution, I attach my private little hack of modify_epub. It is a totally stripped down thing, just searches for some regexes, removes fonts and smartens punctuation.

To individualize it, extract main.py and open it in a simple texteditor (notepad++ for example).

Only thing that needs to be changed is in MY_REGEXES. What to do should be self-explinatory. No need to understand python, just copy/paste the lines and change the regex string.

Now put the new main.py back in the archive and import it in calibre via "load plugin from file". There is now a button in the toolbar to do the search and replace stuff.

Of course this is not rigidly tested and without any guaranties
Attached Files
File Type: zip EpubRegex.zip (17.6 KB, 75 views)
dickloraine is offline   Reply With Quote
Old 03-31-2017, 11:23 AM   #64
gbm
Wizard
gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.
 
Posts: 2,082
Karma: 8796704
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
Quote:
Originally Posted by Rev. Bob View Post
Completely platform-dependent. W3C originally recommended a 1.5x factor between each step in CSS1, then changed their mind and decided 1.2x was better in CSS2, and is now rethinking it yet again. That said, their new table translates to:

H6/xx-small: 0.6em
x-small: 0.75em
H5/small: 0.89em (8/9)
H3/large: 1.2em
H2/x-large: 1.5em
H1/xx-large: 2em

Just don't expect to see that etched in stone anywhere. It's a suggestion, not a set of ironclad rules, and implementations will differ.

No, that's called paying attention to detail. If you want exactly 1em (absolute) of space between lines that are not 1em tall, you have to set the appropriate vertical margin to the reciprocal of the active font size. Simply saying "margin-top: 1em" won't do it; that 1em is relative to the element's current size, not an absolute value.*

In other words, the H2 element traditionally carries a 1em (relative) top and bottom margin. If it also carries the 1.5em (absolute) font size listed above, then the gap between two consecutive H2 elements will be 1.5em (absolute) - translating to "skip a line between H2 elements."

Thus, if you want an actual 1em (absolute) space between those elements, you have to tinker with the margins by setting them to 0.6667em (relative). That way, 0.6667 x 1.5 = 1, and you get what you're after: a gap the size of a line of standard body text.
No that is what is called over thinking and applying a Rube Goldberg solution to a non problem. Doing stuff like that is what makes ebooks look crappie and turns people off from them.

What works on paper does not necessary work on screen, especially small screens.

The KISS principle works best

bernie.
gbm is offline   Reply With Quote
Old 03-31-2017, 04:31 PM   #65
Rev. Bob
Wizard
Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.
 
Rev. Bob's Avatar
 
Posts: 1,760
Karma: 9918418
Join Date: Feb 2013
Location: Here on the perimeter, there are no stars
Device: Kobo H2O, iPad mini 3, Kindle Touch
Quote:
Originally Posted by gbm View Post
No that is what is called over thinking and applying a Rube Goldberg solution to a non problem. Doing stuff like that is what makes ebooks look crappie and turns people off from them.

What works on paper does not necessary work on screen, especially small screens.

The KISS principle works best
"Small screens" has nothing to do with any of this; it's all about relationships between relative unit sizes.

As for "Rube Goldberg solutions," if basic math qualifies as "overthinking" now, call me guilty. There are perfectly valid reasons to do what I described, and they usually fall under the header of making a book look better.

Another example, although one I personally find a little too picky, is when a designer sets a rule for the "row of stars" used to separate scenes inside a chapter and makes the top margin a little bigger than the bottom margin. Why? Because the * character he's using isn't vertically centered; it already has some space at the bottom, and he's compensating for that. (I'd just use • if I was concerned with that, because the dot IS vertically centered.)

In my experience, there are four stages to HTML/CSS layout enlightenment:

1. Relies on HTML default rendering for almost everything.
2. Starts tinkering with CSS to develop a basic visual style.
3. Goes completely into the weeds, realizing that he can theoretically control everything and determined to do exactly that.
4. Realizes that reality isn't theory and pulls back to a more minimalist style that's more flexible and robust while being able to deploy advanced techniques when called for.

Stages two and four can look pretty similar, but too many of the ebooks I see are on stage three. They're determined to lock everything down, and in doing so, they suffer from what I call "overspecification." Quite frequently, those books will look and work a lot better if the excess rules are stripped out to give the reader more control.

Knowing to apply a reciprocal to margins or to shave some bottom-margin from a row of asterisks is stage four. Defining line-height with absolute values that deny flexibility to readers is stage three. There's a pretty big difference there.
Rev. Bob is offline   Reply With Quote
Advert
Old 03-31-2017, 04:41 PM   #66
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,804
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 gbm View Post
No that is what is called over thinking and applying a Rube Goldberg solution to a non problem. Doing stuff like that is what makes ebooks look crappie and turns people off from them.

What works on paper does not necessary work on screen, especially small screens.

The KISS principle works best

bernie.
Hey! I remember waiting for my dad to bring home Honeywell , Rube Goldberg calendars. They were 'creative'
theducks is offline   Reply With Quote
Old 04-01-2017, 12:34 AM   #67
icallaci
Guru
icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.icallaci ought to be getting tired of karma fortunes by now.
 
Posts: 769
Karma: 6528026
Join Date: Sep 2012
Device: Kobo Elipsa
+1,000,000. I completely agree.

Quote:
Originally Posted by Rev. Bob View Post
"Small screens" has nothing to do with any of this; it's all about relationships between relative unit sizes.

As for "Rube Goldberg solutions," if basic math qualifies as "overthinking" now, call me guilty. There are perfectly valid reasons to do what I described, and they usually fall under the header of making a book look better.

Another example, although one I personally find a little too picky, is when a designer sets a rule for the "row of stars" used to separate scenes inside a chapter and makes the top margin a little bigger than the bottom margin. Why? Because the * character he's using isn't vertically centered; it already has some space at the bottom, and he's compensating for that. (I'd just use • if I was concerned with that, because the dot IS vertically centered.)

In my experience, there are four stages to HTML/CSS layout enlightenment:

1. Relies on HTML default rendering for almost everything.
2. Starts tinkering with CSS to develop a basic visual style.
3. Goes completely into the weeds, realizing that he can theoretically control everything and determined to do exactly that.
4. Realizes that reality isn't theory and pulls back to a more minimalist style that's more flexible and robust while being able to deploy advanced techniques when called for.

Stages two and four can look pretty similar, but too many of the ebooks I see are on stage three. They're determined to lock everything down, and in doing so, they suffer from what I call "overspecification." Quite frequently, those books will look and work a lot better if the excess rules are stripped out to give the reader more control.

Knowing to apply a reciprocal to margins or to shave some bottom-margin from a row of asterisks is stage four. Defining line-height with absolute values that deny flexibility to readers is stage three. There's a pretty big difference there.
icallaci is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic routine when sending book to device (Kobo) Doonge Development 4 11-14-2014 08:20 PM
What’s your “image rehab” routine? GrannyGrump Workshop 58 11-23-2013 03:01 AM
help with some modifications moller Kindle Developer's Corner 3 10-12-2012 02:31 PM
Different Send to Device routine based on the library. iatheia Library Management 10 01-24-2012 12:06 PM
iLiad Registry modifications Martijn iRex Developer's Corner 7 03-27-2008 05:37 PM


All times are GMT -4. The time now is 12:21 PM.


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