"margin-top" property is converted into <number>em when converting into MOBI breaking iOS rendering
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
calibre |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
This seems to be a combination of a bug in iOS Kindle App and another in Calibre mobi converter.
Happens in Calibre 5.21.0 under macOS Big Sur 11.4 and as far as I remember since a lot of previous versions because this issue made me stop using Kindle apps for reading non Amazon purchased books.
I'm pasting here the explanation given by "jhowell" user in Mobileread as it describes the exact problem in great detail:
"The EPUB file has a class named saltoinicio which sets margin-top:33% for the first paragraph of a chapter. Percentage for a margin is based on the width of the container so for a typical portrait page orientation that should make the paragraph start about a quarter of the way down the page.
In the MOBI file produced by calibre that 33% is changed to instead be 150em, which is an unreasonably huge value! That looks to me like a calibre bug. This in turn appears to trigger a bug in the MOBI renderer under iOS, causing the paragraph to start on the next page with some of the initial text missing. The MOBI renderer obviously should not be doing that, but it is somewhat of a garbage-in garbage-out situation.
I converted the EPUB to MOBI using Amazon's Kindle Previewer and in the MOBI file that it creates it leaves the value at 33% and this works OK when loaded into Kindle for iOS. So one possible fix to to use that instead of calibre for this conversion."
I can add that with a value of 20% in that property still happens, and the workaround I've found reduce the issue but not eliminate it. I've created a rule in Look & Feel -> Transform Styles that replaces a value >= 20% by 10em in "margin-top" and then the conversion seems done right but still starting of each chapter is shown very strange.
This is the post in Mobilieread cited above that clarifies the issue: https:/
And here is the entire thread: https:/
I'm trying to report iOS Kindle App to Amazon but seems an impossible task to report bugs to them. If someone here knows how to report to them, please let me know.
I'm attaching one scrambled ePub sample and the resulting mobi.
I'm afraid I dont follow at all. First of all are you talking about
historic MOBI or azw3?? Historic MOBI supports no CSS and defintely
doesnt have either em based or percentage based units. If you are
talking about azw3 (i.e. new mobi) then please attach a sample epub file
that shows the issue when converted.
status incomplete