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 01-19-2019, 01:10 PM   #1
ElMiko
Evangelist
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 446
Karma: 65460
Join Date: Jun 2011
Device: Kindle
Line-height from ePub to AW3

Working in ePub, I have text that is split by <br/> tag, where the tage has a css style that adjusts the height of the break.

Code:
Line 1<br class="brheight"/>Line 2

css:
.brheight {
   line-height: 2.5em;
   }
This displays without issue in ePub, but when I convert to AZW3, the line height is re-set to 1em. To be clear, the new stylesheet still retains the same css styling (2.5em), but for some reason, the display doesn't reflect the code.

Any ideas as to what's happening in the conversion process that causes this error?
ElMiko is offline   Reply With Quote
Old 01-19-2019, 03:38 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: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Try leaving off the 'em'
line-height is 'unit less' . it inherits the unit from the current block
line-height: 1.2%;
line-height: 2.5;
theducks is offline   Reply With Quote
Advert
Old 01-19-2019, 04:26 PM   #3
ElMiko
Evangelist
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 446
Karma: 65460
Join Date: Jun 2011
Device: Kindle
Quote:
Originally Posted by theducks View Post
Try leaving off the 'em'
line-height is 'unit less' . it inherits the unit from the current block
line-height: 1.2%;
line-height: 2.5;
Nee-ope. Gave that a try Multiple iterations (just the 2.5/1.2% and 2.5/250% and 2.5/et al). Still converts to the break to a single line...

Still, thanks for the tip on em; will be sure to (dis)integrate that into my future css.
ElMiko is offline   Reply With Quote
Old 01-19-2019, 05:01 PM   #4
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: 79,740
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
<br/> is a bad idea when you can do this in CSS. The following will work and you can dump the <br/> as the CSS is creating the space and not the <br/>/

Code:
<p class="brheight">This is a test></p>

.brheight {
  margin-top: 2.5em;
}
JSWolf is offline   Reply With Quote
Old 01-20-2019, 12:07 AM   #5
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: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The display in what? Kindles, calibre's viewer?
kovidgoyal is offline   Reply With Quote
Advert
Old 01-20-2019, 10:25 AM   #6
ElMiko
Evangelist
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 446
Karma: 65460
Join Date: Jun 2011
Device: Kindle
Quote:
Originally Posted by kovidgoyal View Post
The display in what? Kindles, calibre's viewer?
In calibre's viewer and in Kindle.


re: using <p> tags — sometimes I'd like a line break that still inherits the specific class attributes of the initial element. Using a <br/> tag is an efficient way to do that (provided it works). Again, what's surprising to me is that it displays without any problem in ePub (both in Sigil and in calibre), but then gets ignored in an AZW3 conversion.
ElMiko is offline   Reply With Quote
Old 01-20-2019, 11:00 AM   #7
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,183
Karma: 8888888
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
Quote:
Originally Posted by ElMiko View Post
In calibre's viewer and in Kindle.


re: using <p> tags — sometimes I'd like a line break that still inherits the specific class attributes of the initial element. Using a <br/> tag is an efficient way to do that (provided it works). Again, what's surprising to me is that it displays without any problem in ePub (both in Sigil and in calibre), but then gets ignored in an AZW3 conversion.
Then just use a no-break-space.

Code:
<p>*</p>
bernie
gbm is offline   Reply With Quote
Old 01-20-2019, 11:27 AM   #8
Brett Merkey
Not Quite Dead
Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.
 
Posts: 195
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
Quote:
a line break that still inherits the specific class attributes of the initial element. Using a <br/> tag is an efficient way to do that (provided it works)
The way you have formulated the above statement indicates that you are no newbie to the practice and art of presentational coding. I agree with the advice of JSWolf that you would be happier using more conventional and more easily convertible style habits.

As you can tell from comparing the code transformation of any epub to azw3 conversion, Calibre can produce some bizarro tag soup that is difficult to describe. Apparently this is by design. The only way to insure what you want after a conversion is to re-edit the azw3 version. For me, this means eliminating any style with "calibre" in its name. This is usually more trouble than it is worth because Calibre, overall, does a commendable job in dealing with all the contingencies that various coding habits present.
Brett Merkey is offline   Reply With Quote
Old 01-20-2019, 12:11 PM   #9
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 7,069
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
I did some playing around with this, adding the style "line-height: 2.5em" to a <br> element. I used the Kindle Previewer to convert the book in order to avoid any issues that may be introduced by calibre conversion.

In the MOBI portion of the Master MOBI created by the Previewer, the style is simply eliminated from the <br>.

In the KF8 (azw3) the style is left intact, but is ignored by the renderer when displaying the book.

In the KFX (enhanced typesetting) view created by the Previewer the line-height was retained, but applied to the line above the break, causing there to be two gaps in the paragraph. This reflects how most modern Kindle devices and apps would display that markup in a book sold on Amazon.

I recommend just using multiple <br> elements and living with the restriction of having only integer multiple sizes available.

Last edited by jhowell; 01-20-2019 at 09:52 PM.
jhowell is offline   Reply With Quote
Old 01-20-2019, 02:07 PM   #10
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: 79,740
Karma: 145864619
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 jhowell View Post
I did some playing around with this, adding the style "line-height: 2.5em" to a <br> element. I used the Kindle Previewer to convert the book in order to avoid any issues that may be introduced by calibre conversion.

In the MOBI portion of the Master MOBI created by the Previewer, the style is simply eliminated from the <br>.

In the KF8 (azw3) the style is left intact, but is ignored by the renderer when displaying the book.

In the KFX (enhanced typesetting) view created by the Previewer the line-height was retained, but applied to the line above the break, causing there to be two gaps in the paragraph. This reflects how most modern Kindle devices and apps would display that markup in a book sold on Amazon.

I recommend just using multiple <br> elements and living with the restriction of having only integral sizes available.
I disagree with double <br/>. Go with the code I posted in message #4 of this thread. It does work ePub, KF8, KFX, and should work for Mobi.

However, if this is a section break, you can try a padding-top instead of a margin-top. I know this works better with ePub. I don't know what it would do in Mobi. But KF8 should works and KFX, I am unsure.
JSWolf is offline   Reply With Quote
Old 01-20-2019, 02:33 PM   #11
ElMiko
Evangelist
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 446
Karma: 65460
Join Date: Jun 2011
Device: Kindle
So, if I absolutely have to rely on <p> for consistently displaying the desired line-break characteristics, obviously that's the way to go! But I am curious as to why <br /> code should be problematic. Has it been deprecated? I confess that I'm "self-educated" on html, which means there are huge gaps in my knowledge and probably several aspects that I THINK I understand, but actually don't (like, assigning the "em" unit to line-height, for example!).

Last edited by ElMiko; 01-20-2019 at 02:38 PM.
ElMiko is offline   Reply With Quote
Old 01-20-2019, 02:44 PM   #12
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: 79,740
Karma: 145864619
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 ElMiko View Post
So, if I absolutely have to rely on <p> for consistently displaying the desired line-break characteristics, obviously that's the way to go! But I am curious as to why <br /> code should be problematic. Has it been deprecated? I confess that I'm "self-educated" on html, which means there are huge gaps in my knowledge and probably several aspects that I THINK I understand, but actually don't (like, assigning the "em" unit to line-height, for example!).
I strip out all line-height except where needed and in most eBooks, it's not needed. So out if goes.

As for <br/>, I prefer to deal with line spacing in CSS and not use them in that manor. Yes, <br/> works for breaking a line in two. But for using it to add a line space, forget it. It's a kludge and poor coding. Also, it's more difficult if you want ot change the spacing. You have to then dump the <br/> and put in the SS code that should have been there in the first place.


As for em, there's no reason not to use it as it's scalable unlike px or pt.
JSWolf is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
line height Rellwood Conversion 3 04-07-2018 04:34 AM
Line Height problem when converting from epub to pdf valida Conversion 7 10-06-2017 05:44 AM
Line Height (Tibetan font) EPUB to PDF ncs Conversion 0 02-05-2014 02:21 AM
[Old Thread] Epub Output: Line Height greenapple Conversion 20 01-27-2013 09:27 AM
Epub line height problem dorotie Calibre 5 08-24-2010 03:23 PM


All times are GMT -4. The time now is 05:24 AM.


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