Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 03-17-2024, 06:17 PM   #1
Jane Eyre
Zealot
Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.
 
Jane Eyre's Avatar
 
Posts: 105
Karma: 6368
Join Date: Nov 2018
Location: Italy
Device: Kindle P.white3/Kobo Clara 2E
No centered text, kepub ebook.

Hello, guys
I have an odd issue with centered text in a epub changed into a kepub ebook by means of "kepub output" Calibre plug in.

In my style sheet I've got this simple class:

.center
{
text-align: center;
text-indent:0;
font-style:italic;
}

I write my epubs directly into Sigil; the preview shows the text as I like it, in the middle of the page, but when I open my converted kepub in my Clara, nothing..it ignores it. Why?
Jane Eyre is offline   Reply With Quote
Old 03-17-2024, 08:04 PM   #2
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
I've encountered a similar problem. If I give the class a margin-left and margin-right of auto or a specific %, that usually fixes it. It doesn't happen all the time, so I'm not sure what circumstances trigger it (divs but not ps, for example). Someone else probably has better insight about this than I do.
icallaci is offline   Reply With Quote
Advert
Old 03-18-2024, 12:38 AM   #3
Sirtel
Grand Sorcerer
Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.
 
Sirtel's Avatar
 
Posts: 10,146
Karma: 224760044
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
Do you have a justification option selected on your Clara? That would also justify centered text in kepubs. If you select "off" for justification, will the centered text display correctly?
Sirtel is online now   Reply With Quote
Old 03-18-2024, 03:14 AM   #4
chrisridd
Guru
chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.
 
chrisridd's Avatar
 
Posts: 928
Karma: 2146660
Join Date: Nov 2011
Location: London, UK
Device: Kobo Aura, Kobo Aura ONE, Marvin 3
This sounds like the feature that this patch to libnickel changes:

Code:
Un-Force user text-align in div,p tags in KePubs:
  - Enabled: yes
  - Description: |
      This patch allows the text alignment set by the publisher in the kepub
      stylesheet to override the alignment selected by the reader from the device.
    #     div, p { text-align: %1 !important; }
    # --> body   { text-align: %1 !important; }
  - FindBaseAddressString: "div, p { text-align: %1"
  - ReplaceString:
      Find:    "div, p {"
      Replace: "body   {"
      MustMatchLength: yes
You could experiment using an element that isn't a div or p.
chrisridd is online now   Reply With Quote
Old 03-18-2024, 05:49 AM   #5
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: 74,015
Karma: 129333114
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 Sirtel View Post
Do you have a justification option selected on your Clara? That would also justify centered text in kepubs. If you select "off" for justification, will the centered text display correctly?
This sounds exactly like the aforementioned bug.
JSWolf is offline   Reply With Quote
Advert
Old 03-18-2024, 06:04 AM   #6
Jane Eyre
Zealot
Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.
 
Jane Eyre's Avatar
 
Posts: 105
Karma: 6368
Join Date: Nov 2018
Location: Italy
Device: Kindle P.white3/Kobo Clara 2E
Quote:
Originally Posted by Sirtel View Post
If you select "off" for justification, will the centered text display correctly?
Yes, it does. Exactly.
Jane Eyre is offline   Reply With Quote
Old 03-18-2024, 08:52 AM   #7
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
Interesting. I have justification set to off, but I also have the "Un-Force user text-align in div,p tags in KePubs" patch enabled. Maybe that's what messes up centered images, although it doesn't seem to affect text in my case. One of these days, I'll have to experiment. I've been using margin-left/right: auto in the css, which seems to take care of it.

Edit: I just checked to see which patches I have enabled, and "Un-Force user text-align" isn't one of them. I must have stopped using that one at some point. I haven't noticed a problem with centering lately either, so who knows?

Last edited by icallaci; 03-18-2024 at 09:03 AM.
icallaci is offline   Reply With Quote
Old 03-18-2024, 10:35 AM   #8
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,164
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
margin-left and margin-right is best at zero (0) for centred anything in CSS
Quoth is offline   Reply With Quote
Old 03-18-2024, 11:21 AM   #9
Sirtel
Grand Sorcerer
Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.
 
Sirtel's Avatar
 
Posts: 10,146
Karma: 224760044
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
Quote:
Originally Posted by Quoth View Post
margin-left and margin-right is best at zero (0) for centred anything in CSS
Yes. Unfortunately I've seen lots of ebooks (mostly self-published) where there is centered text with a left or right margin >0 (not both margins, no, one of them) or a text indent >0. No piece of code is stupid enough not to use, it seems.
Sirtel is online now   Reply With Quote
Old 03-20-2024, 06:47 AM   #10
Jane Eyre
Zealot
Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.
 
Jane Eyre's Avatar
 
Posts: 105
Karma: 6368
Join Date: Nov 2018
Location: Italy
Device: Kindle P.white3/Kobo Clara 2E
I did a little more testing..I can confirm you that just kepub format ignores

Code:
text-align: center;
when justification is on. The same book, as an epub standard, works well. I have no need to switch justification off
At this point, epub are better than kepub with a kobo.
Jane Eyre is offline   Reply With Quote
Old 03-20-2024, 08:52 AM   #11
Sirtel
Grand Sorcerer
Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.
 
Sirtel's Avatar
 
Posts: 10,146
Karma: 224760044
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
Quote:
Originally Posted by Jane Eyre View Post
I did a little more testing..I can confirm you that just kepub format ignores

Code:
text-align: center;
when justification is on. The same book, as an epub standard, works well. I have no need to switch justification off
At this point, epub are better than kepub with a kobo.
That depends. I have justification always switched off with both epubs and kepubs, because I specify the justification in the css of the book; so for me there's no need to switch justification ON.
Sirtel is online now   Reply With Quote
Old 03-20-2024, 11:13 AM   #12
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by Jane Eyre View Post
I did a little more testing..I can confirm you that just kepub format ignores

Code:
text-align: center;
when justification is on. The same book, as an epub standard, works well. I have no need to switch justification off
At this point, epub are better than kepub with a kobo.
There's nothing mysterious happening here. Every reading app I've ever used (Sony, Kobo, PocketBook, Android) applies its own version of simple override CSS when you choose that reading app's "alignment option".

The Kobo Adobe reading app, used for standard epub, applies override CSS:
Code:
body {text-align: %1 !important;}
and the Kobo kepub reading app applies override CSS:
Code:
div, p { text-align: %1 !important;}
where %1 is the value you selected in the Kobo's [Aa] menu Justification buttons.

So if your epub's HTML/CSS for scenebreaks is something like:

Code:
<p class="center">***</p>

.center {text-align: center}
then the scenebreaks in an epub will be centred no matter what alignment option you set in the [Aa] menu. However the same code in a kepub will not be centred if you set the alignment in the [Aa] menu to anything other than 'Off' (i.e. don't apply alignment override CSS).

There are similar (but not the same) CSS override differences between the epub and kepub reading apps for the other settings in the [Aa] menu, namely font-family and line-height.

Whatever Kobo chooses as default CSS overrides some users will be upset. These users are at liberty to use existing kobopatches to change override CSS to something more (or less) heavy-handed.
jackie_w is offline   Reply With Quote
Old 03-21-2024, 02:50 AM   #13
Jane Eyre
Zealot
Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.Jane Eyre got an A in P-Chem.
 
Jane Eyre's Avatar
 
Posts: 105
Karma: 6368
Join Date: Nov 2018
Location: Italy
Device: Kindle P.white3/Kobo Clara 2E
Quote:
Originally Posted by jackie_w View Post
The Kobo Adobe reading app, used for standard epub, applies override CSS:
Code:
body {text-align: %1 !important;}
and the Kobo kepub reading app applies override CSS:
Code:
div, p { text-align: %1 !important;}
where %1 is the value you selected in the Kobo's [Aa] menu Justification buttons.

So if your epub's HTML/CSS for scenebreaks is something like:

Code:
<p class="center">***</p>

.center {text-align: center}
then the scenebreaks in an epub will be centred no matter what alignment option you set in the [Aa] menu. However the same code in a kepub will not be centred if you set the alignment in the [Aa] menu to anything other than 'Off' (i.e. don't apply alignment override CSS).
I know nothing about %1 in css. I don't use that in my sheets, but if it was something similar setted in my purchased ebooks, I've no idea.

Quote:
Originally Posted by jackie_w View Post
These users are at liberty to use existing kobopatches to change override CSS to something more (or less) heavy-handed.
For God's sake no! Gosh.. no no. I 've never put myself in quicksands with patches, hacking or some similar stuff.
Jane Eyre is offline   Reply With Quote
Old 03-21-2024, 04:10 AM   #14
chrisridd
Guru
chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.
 
chrisridd's Avatar
 
Posts: 928
Karma: 2146660
Join Date: Nov 2011
Location: London, UK
Device: Kobo Aura, Kobo Aura ONE, Marvin 3
So the cleanest solution seems to me to use another HTML element that doesn't match the default non-patched kepub stylesheet, and then style that to be centred. For example:

Code:
<span class="centred">***</span>
...

span.centred {
    display: block;
    text-align: center;
    /* etc */
}
Pick another element if abusing <span> offends, but you get the idea.
chrisridd is online now   Reply With Quote
Old 03-21-2024, 04:11 AM   #15
Aleron Ives
Wizard
Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.
 
Posts: 1,026
Karma: 11500112
Join Date: Sep 2022
Device: Kobo Libra 2
Quote:
Originally Posted by Jane Eyre View Post
I 've never put myself in quicksands with patches, hacking or some similar stuff.
It's not that hard, and it greatly enhances your ability to customise the device to your liking, which is one of Kobo's strengths.
Aleron Ives is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
centered text having a specific width Vroni ePub 18 08-07-2019 05:23 AM
Conversion ePub -> azw3, text centered apeiron75 Calibre 0 05-18-2013 12:28 PM
Calibre screwing up centered-text b/c of forced tabs lurker316 Calibre 0 12-21-2010 09:36 PM
.epub hyperlinks, centered and non indented text. Xabache ePub 2 09-13-2010 01:11 PM
Centered and right aligned text for Stanza on iPhone Arjen ePub 6 06-17-2010 12:19 PM


All times are GMT -4. The time now is 09:16 AM.


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