![]() |
#1 |
Unicycle Daredevil
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,944
Karma: 185432100
Join Date: Jan 2011
Location: Planet of the Pudding Brains
Device: Aura HD (R.I.P. After six years the USB socket died.) tolino shine 3
|
How to make Kobo's Kepub renderer do its job?
I normally stay away from kepubs, mainly because I don't like the mandatory header and detest those silly reading stats.
But now I have been forced to tinker with the format a little bit because it doesn't fail in one little detail where Kobo's standard epub renderer does. But the kepub renderer fall short in so many other ways: It ignores - "text-decoration: none" for links and underlines them anyway, - "text-align: center" and - "page-break-before:always" are both blithely ignored as well. All three of the above work perfectly fine on the standard epub renderer, as well as in ADE and both Sigil's and Calibre's previews. They fail in the kepub renderer, no matter if I just change the file extension or run the file through Calibre's epub > kepub conversion plugin. I must be doing something wrong; can't believe the renderer is that bad... |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,595
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Where do you find that "text-align: center" doesn't work. All my headers have that justification, and they are centered (probing that I don't fix the alignment at the ereader options).
|
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Unicycle Daredevil
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,944
Karma: 185432100
Join Date: Jan 2011
Location: Planet of the Pudding Brains
Device: Aura HD (R.I.P. After six years the USB socket died.) tolino shine 3
|
Quote:
And thanks for reminding me of the headers: The font I've embedded for them isn't displayed either. |
|
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,595
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
No, I have centered elements aside of the headers (separator, for example) and they appear as I define them. I think it's something at the settngs.
|
![]() |
![]() |
![]() |
#5 | |
Unicycle Daredevil
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,944
Karma: 185432100
Join Date: Jan 2011
Location: Planet of the Pudding Brains
Device: Aura HD (R.I.P. After six years the USB socket died.) tolino shine 3
|
Quote:
CSS: Code:
div.prose > p.center {text-align:center; text-indent:0} Code:
<div class="prose"> <p class="center">[1932]</p> </div> |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,248
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
@doubleshuffle,
I think your problem with 'lost text-aligns' is because the kepub renderer enforces overriding CSS for <div> and <p> elements. By default it has the following sledgehammer applied: Code:
div, p { text-align: %1 !important; } If you're already using the Kobo Patcher for other tweaks you should try enabling the patch labeled Code:
patch_name = `Un-Force user text-align in div,p tags in KePubs` Code:
body { text-align: %1 !important; } |
![]() |
![]() |
![]() |
#7 |
Unicycle Daredevil
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,944
Karma: 185432100
Join Date: Jan 2011
Location: Planet of the Pudding Brains
Device: Aura HD (R.I.P. After six years the USB socket died.) tolino shine 3
|
Well, that's a sledgehammer indeed.
Thanks a lot. Very helpful reply! I do patch my Kobo, I've just never bothered with the kepub patches. Seems I'll have to now. Or I'll use the quick and dirty fix for my little problem that caused me to try kepub, and keep on keeping away from that format. Sheesh, seeing my styles so awfully ignored felt like trying out FB-Reader years ago... |
![]() |
![]() |
![]() |
#8 |
Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
No need to patch things. Just change your stylesheet slightly.
The !important in the Kobo rule is evil for a built-in rule, because it overrides anything that isn't similarly marked !important. However, if you add !important to your stylesheet, specificity rules come back into play. In other words: Code:
div.prose > p.center {text-align:center !important; text-indent:0 !important;} |
![]() |
![]() |
![]() |
#9 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,064
Karma: 144284144
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
#10 | |
Unicycle Daredevil
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,944
Karma: 185432100
Join Date: Jan 2011
Location: Planet of the Pudding Brains
Device: Aura HD (R.I.P. After six years the USB socket died.) tolino shine 3
|
Quote:
RMSDK on Kobo doesn't display right-to-left text correctly. See here. |
|
![]() |
![]() |
![]() |
#11 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,064
Karma: 144284144
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
#12 | ||
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Quote:
Have you had any success with the !important modifier vis-a-vis the Previewer, at Kobo's website? I have a client that paid some damn good money, for a rather complex ebook (exercises...you know). We did said book. After a lot of blood, pain and suffering, the book met with her approval. (And, thank you, sweet Baby Jesus...). But, alas, the bloody book seems to have MIA top-margins (or bottom. At this point, I no longer remember). So, after us tweaking the thing more than a few times, to no avail, she complains to Kobo Support. She's not a bad client--I mean, she's not bitching AT me, she's asking for our help. Just wanna be clear about that. So, her and Kobo: Back-forth, back-forth, yadda. Finally, one of their "techs" FIXES < ![]() I review the "fixed" ePUB, and whichever way it was ignoring, the Tech swapped out top-margin for bottom on the preceding element. Fine. Whatever, at this point. But, lo: the "fixed" ePUB doesn't work, EITHER. Not in the Preview. Vertical whitespace between things like a set of images and the destructions for that exercise are collapsed. To me, the book doesn't look godawful (and I'm picky), but not as "great" as it looked when done. Nonetheless, the point here is: apparently, their own damn techs can't make KEPUB work, EITHER. Have you had any success taming kePUB's preview, Dag? Or are you saved from that indignity? I'd like to assist this client if I can. The "expert" tech used the important modifier, which seemed to do absolutely zippo, zilch, nein, nada. Spoiler:
Hitch |
||
![]() |
![]() |
![]() |
#13 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
No! I absolutely hate it. It should not be necessary at all. A reader should behave and use the stylesheet as delivered by default. If you want to enable all kind of changes in your reader (like font-size), fine. Then overrule the stylesheet. But the stylesheet should be the primary layout source.
|
![]() |
![]() |
![]() |
#14 | |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Anyway, I was wondering if I was being old and cranky (forebear from the obvious comeback on this, gang) in particular about this topic. My gang of merry bookmakers knows that I want them to try EVERYTHING other than important...and if you ask me why, I'm not sure I have a great answer, other than...seems like a cop-out shortcut. {shrug} Hitch |
|
![]() |
![]() |
![]() |
#15 | |
Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
Quote:
Again, though, be aware that it isn't necessarily sufficient to just add !important. You also have to add additional elements and/or classes to the rule until you've raised its specificity above the built-in rule's specificity. That's the bit that many attempts at overriding evil stylesheets often miss. ![]() Something else that can often bite you (particularly in iBooks' built-in stylesheets) is the universal selector (*), because it means that for some styles, you might need to do things like: Code:
p.whatever {style_rule_here !important; } p.whatever * {style_rule_here !important; } The one that got me was that Kobo reader (at least I think it was Kobo) had a bug where if you reduced the left an right margins to zero, you'd get parts of one page on the previous page. I think I filed a bug about that, and they fixed it in a subsequent release. That said, I might be remembering some other reader. They all run together after a while. ![]() |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kobo kepub Problems | AmandaM | ePub | 19 | 12-24-2016 11:41 AM |
Feature suggestion: Tweak to make job window not always on top | Katsunami | Calibre | 3 | 01-24-2016 01:26 PM |
Make job progress indicator more useful | THenrich | Recipes | 6 | 07-30-2014 02:53 AM |
Force Calibre to make one Job at a time? | JayKindle | Calibre | 2 | 09-11-2011 04:05 PM |