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 07-31-2019, 10:54 PM   #1
jdunning
Member
jdunning began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Jul 2019
Device: Kindle Oasis
Does converting to KFX format change or limit the CSS styling of the source file?

I have a zipped HTML source file that I've converted to AZW3 format via Calibre, and the text formatting and layout look the way I want. I then tried converting the zip to KFX to take advantage of enhanced typsetting, and a number of the styles changed. I'm wondering if these are limitations of the KFX format or if I'm doing something wrong.

For instance, there are sections of paragraphs that are outdented and show a ~ at the beginning. The CSS looks like:

Code:
div.thoughts p {
	text-indent: 0;
	padding-left: 1em;
	position: relative;
}

div.thoughts p::before {
	content: "~";
	left: 0;
	position: absolute;
}
That looks great with AZW3, but the "position: absolute;" seems to be ignored in the KFX file when viewed in the Kindle Previewer or on an Oasis 2. I'm wondering if the plugin is stripping the position, or if it's being ignored by the Kindle renderer.

On normal paragraphs, I've got "text-indent: 1em;" which again looks correct in AZW3 but seems to get converted to something that's more like .5em in the KFX. And when changing the font size, the text indent doesn't scale. It's like it's been set to a fixed pixel width.

There's also some left padding that I can't seem to get rid of on <ul> elements in KFX. And "font-family: monospace" text renders much bigger in the KFX version for some reason, even though the font-size is all 1em.

Are there any workarounds for these issues? Or am I doing something wrong? The only thing I seem to be getting from the "enhanced" typsetting is dropcaps looking correct and the 3x3 grid for quick navigation.
jdunning is offline   Reply With Quote
Old 08-01-2019, 07:21 AM   #2
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: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
Quote:
Or am I doing something wrong?
It does not look as if you are doing anything wrong except perhaps you are expecting print-level precision in the vastly more variable world of screen devices.

I have not used the Calibre KFX plug-in but my experience with AZW editing is that absolute and relative positioning should be avoided if you seek a predictable and robust screen behavior.
Brett Merkey is offline   Reply With Quote
Advert
Old 08-01-2019, 08:34 AM   #3
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: 6,541
Karma: 84810789
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
In the process of converting to KFX Amazon applies heuristics intended to improve the book layout and tighten up spacing. That includes changing the size and units of elements in some cases. Those "improvements" are not always desirable.

The Kindle Publishing Guidelines specifically warns against the use of the "position" property, except for fixed layout books. It is not handled consistently.

You can try to compensate for some of the changes made during KFX conversion, but that will be a trial and error process.

Last edited by jhowell; 08-01-2019 at 08:37 AM.
jhowell is online now   Reply With Quote
Old 08-01-2019, 10:35 PM   #4
jdunning
Member
jdunning began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Jul 2019
Device: Kindle Oasis
Quote:
Originally Posted by jhowell View Post
Those "improvements" are not always desirable.
...
You can try to compensate for some of the changes made during KFX conversion, but that will be a trial and error process.
Thanks! Yeah, I spent some frustrating time today trying to work around some of these issues, but didn't get anywhere. What I've learned:
  • Putting margin-left: -1em on anything causes the KFX conversion in Calibre to fail with a generic error.
  • A negative text-index on <p>'s that aren't inside an <li> seems to get ignored and reset to 0 (or possibly only when they're combined with ::before content).
  • <ul>'s have some padding-left that I can't seem to get rid of. It's like there's a useragent stylesheet on the Kindle that overrides the book's style.
  • Monospaced paragraphs seem to render larger than they do in the .azw3 format.
  • There doesn't seem to be any way to create hanging indents with a custom bullet point.
  • Kindle Previewer is terrible software.

I'm not sure that getting proper dropcaps and the page-flip navigation is worth all that pain.
jdunning is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change .docx source file from eBook Margrave Editor 1 02-15-2019 04:46 PM
can the source file change line spacing in final epub? Gregg Bell Sigil 10 06-02-2017 05:44 PM
New Kindle's KFX file format DeepVoid Library Management 14 04-21-2017 10:28 AM
Incorrect styling with specific CSS quiris Marvin 9 07-04-2016 01:04 PM
How to change source file without re-entering meta data? therealjoeblow Calibre 4 06-29-2010 07:12 PM


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


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