Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 07-09-2018, 09:33 AM   #1
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,292
Karma: 2385865
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
about poetry

Hi

I am looking for the CSS code I could use for looong verses like the ones in the joint screenshot.

Thanks for any help.
Attached Thumbnails
Click image for larger version

Name:	poetry.png
Views:	92
Size:	90.8 KB
ID:	164955  
roger64 is offline   Reply With Quote
Old 07-09-2018, 02:27 PM   #2
BobC
Fanatic
BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.
 
Posts: 566
Karma: 1156144
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
I think you need to look at using "direction" -

This looks like it will get near to what you are looking for :

Code:
<p class= "poem"> A bunch of the boys were whooping it up in the Malamute Saloon </p>
<p class= "poem">  The kid that handled the music box was hitting a ragtime tune </p>
 <p class= "poem">Back of the bar, in a solo game, sat Dangerous Dan McGrew,</p>
<p class= "poem">And watching his luck was his light-o'-love, the lady that's known as Lou.</p>
with the following css style:
Code:

.poem {
  text-align: justify;
  direction : rtl;
  text-indent: 0;
}
This though gets messy handling the second comma on the third line.

BobC
BobC is offline   Reply With Quote
Advert
Old 07-09-2018, 03:43 PM   #3
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,292
Karma: 2385865
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Thank you Bob for your help.

This code is new for me. Up to now I though that direction was only used for some foreign languages. I'll try it.

I shall very soon make some trials and report it back.

I shall try also a float:right span, but this does not look very flexible...

Last edited by roger64; 07-09-2018 at 04:04 PM.
roger64 is offline   Reply With Quote
Old 07-09-2018, 08:14 PM   #4
jhowell
Wizard
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: 2,261
Karma: 23443868
Join Date: Nov 2011
Location: Florida
Device: Oasis 2, Fire, iPad Air 2, Nexus 7
It is too bad that text-align-last: right isn't well supported.
jhowell is offline   Reply With Quote
Old 07-09-2018, 09:06 PM   #5
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 6,777
Karma: 62512628
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, and NookColor. 2 Droid, 1 Win8 ePUB rdrs
Quote:
Originally Posted by roger64 View Post
Thank you Bob for your help.

This code is new for me. Up to now I though that direction was only used for some foreign languages. I'll try it.

I shall very soon make some trials and report it back.

I shall try also a float:right span, but this does not look very flexible...
Sorry to be a buzzkill, but that's not going to work. That text is not, in fact, reading RtoL; it's reading Left-to-right, like all Euro-based languages, and the line wrap is simply right-aligned, nothing more nor less. if you use R2L, the text will, indeed, read R2L, not merely flush-right line-wraps.

Quote:
Originally Posted by jhowell View Post
It is too bad that text-align-last: right isn't well supported.
Yeah, it's not supported at all, afaik, other than maybe in ePUB3.

This sounds like yet another case for client education.

Hitch
Hitch is offline   Reply With Quote
Advert
Old 07-10-2018, 01:27 AM   #6
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,292
Karma: 2385865
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
@Hitch

You said, if I understand you well (not sure), that the "rtl" proposal from Bob is not going to work.

How would you "right-align the line-wrap"?
roger64 is offline   Reply With Quote
Old 07-10-2018, 07:12 AM   #7
BobC
Fanatic
BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.
 
Posts: 566
Karma: 1156144
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
There are clearly problems with the RTL suggestion I made, however to say it wouldn't work is perhaps being a bit pedantic (that's usually my job).

I did try it out on a test document and visually it seemed to do what you had asked for.

If you used a text-to-speech reader on the text it would read it "backwards", however it does appear on a printed page in the correct order. Another issue which I hinted at in my initial post was that of punctuation within a line, where a comma can appear at the start of a wrapped line rather than at the end of the previous one.

Ultimately I think you need to consider how essential it is that the visual format follows exactly your source (I assume that is what you are trying to emulate), there are plenty of other ways to format a poem which can be achieved using standard formatting techniques. "text-align-last : right" may well be the correct way to do it but if readers don't support it then some sort of compromise is in order. It all depends on what you want to do with the book - just read it yourself on a known device or have it published, perhaps in other formats than epub.

BobC
BobC is offline   Reply With Quote
Old 07-10-2018, 09:08 AM   #8
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 6,777
Karma: 62512628
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, and NookColor. 2 Droid, 1 Win8 ePUB rdrs
Quote:
Originally Posted by BobC View Post
There are clearly problems with the RTL suggestion I made, however to say it wouldn't work is perhaps being a bit pedantic (that's usually my job).

I did try it out on a test document and visually it seemed to do what you had asked for.

If you used a text-to-speech reader on the text it would read it "backwards", however it does appear on a printed page in the correct order. Another issue which I hinted at in my initial post was that of punctuation within a line, where a comma can appear at the start of a wrapped line rather than at the end of the previous one.

Ultimately I think you need to consider how essential it is that the visual format follows exactly your source (I assume that is what you are trying to emulate), there are plenty of other ways to format a poem which can be achieved using standard formatting techniques. "text-align-last : right" may well be the correct way to do it but if readers don't support it then some sort of compromise is in order. It all depends on what you want to do with the book - just read it yourself on a known device or have it published, perhaps in other formats than epub.

BobC

Bob:

Perhaps I should have elaborated, but in my line of work, which is commercial formatting, I can't put forth a layout that would read backwards, no matter what, in TTS. I mean...just can't. I have other reasons for thinking that it won't work quite like expected, but that's my first and foremost objection.

I'm tied up this am, but if I get a chance, I'll post in more detail.

Hitch
Hitch is offline   Reply With Quote
Old 07-10-2018, 10:31 AM   #9
BobC
Fanatic
BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.
 
Posts: 566
Karma: 1156144
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
@Hitch,

I understand the point about commercial publishing and assumed that was where you were coming from. I now have to revise my own comments as I have just looked at the test document that I said looked fine, this time with Adobe Reader, and it doesn't work there - it simply wraps as if the RtoL wasn't there. It looked o.k in Calibre's viewer and I hadn't bothered to check it out with Adobe.

What I haven't done is load the test doc onto one of my ebook readers to see what it looks like there.

That's the problem with trying to be clever - unless you have total control over the viewing environment it's best to stick to simple stuff.

BobC
BobC is offline   Reply With Quote
Old 07-10-2018, 10:39 AM   #10
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 6,777
Karma: 62512628
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, and NookColor. 2 Droid, 1 Win8 ePUB rdrs
Quote:
Originally Posted by BobC View Post
@Hitch,

I understand the point about commercial publishing and assumed that was where you were coming from. I now have to revise my own comments as I have just looked at the test document that I said looked fine, this time with Adobe Reader, and it doesn't work there - it simply wraps as if the RtoL wasn't there. It looked o.k in Calibre's viewer and I hadn't bothered to check it out with Adobe.

What I haven't done is load the test doc onto one of my ebook readers to see what it looks like there.

That's the problem with trying to be clever - unless you have total control over the viewing environment it's best to stick to simple stuff.

BobC
Bob:

Many times, even if you do have total control over the test environment, it's best to stick to simple stuff, LOL. I have enough eReaders to start my own damn museum and trust me, simple=good.

Hitch
Hitch is offline   Reply With Quote
Old 07-11-2018, 07:25 AM   #11
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,292
Karma: 2385865
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Well, this is what I decided to use.
Each verse has its own paragraph style (Chanson) and the stanza is kept within a div (space) tag. As the length of the verses is variable, I could not find a perfect solution and had to compromise. I tried this one on a six inches screen, it should possibly be better on wider ones, and dubious on smartphones.

I made use of a negative indent which seems to be correctly supported for ePub and PDF. A screenshot is joined. No idea for others (hello Hitch!).

Code:
p {
  display: block;
  margin-top: 0;
  margin-bottom: 0;
  border: none;
  padding: 0;
  text-indent: 1.5em;
  text-align: justify;
  widows: 2;
  orphans: 2;
}
p.Chanson {
  margin-left: 70%;
  margin-right: 0;
  margin-top: 0;
  margin-bottom: 0;
  border: none;
  padding: 0;
  text-indent: -65%;
  text-align: justify;
  font-style: italic;
}
.space {
  margin-top: 12px;
  margin-bottom: 12px;
}
Attached Thumbnails
Click image for larger version

Name:	poetry2.png
Views:	49
Size:	18.1 KB
ID:	164986  

Last edited by roger64; 07-11-2018 at 07:28 AM.
roger64 is offline   Reply With Quote
Old 07-11-2018, 09:09 AM   #12
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 6,777
Karma: 62512628
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, and NookColor. 2 Droid, 1 Win8 ePUB rdrs
Quote:
Originally Posted by roger64 View Post
Well, this is what I decided to use.
Each verse has its own paragraph style (Chanson) and the stanza is kept within a div (space) tag. As the length of the verses is variable, I could not find a perfect solution and had to compromise. I tried this one on a six inches screen, it should possibly be better on wider ones, and dubious on smartphones.

I made use of a negative indent which seems to be correctly supported for ePub and PDF. A screenshot is joined. No idea for others (hello Hitch!).

Code:
p {
  display: block;
  margin-top: 0;
  margin-bottom: 0;
  border: none;
  padding: 0;
  text-indent: 1.5em;
  text-align: justify;
  widows: 2;
  orphans: 2;
}
p.Chanson {
  margin-left: 70%;
  margin-right: 0;
  margin-top: 0;
  margin-bottom: 0;
  border: none;
  padding: 0;
  text-indent: -65%;
  text-align: justify;
  font-style: italic;
}
.space {
  margin-top: 12px;
  margin-bottom: 12px;
}
Question, if I may?

Why the px measurement for the top/bottom margins?

Hitch
Hitch is offline   Reply With Quote
Old 07-11-2018, 11:30 AM   #13
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,292
Karma: 2385865
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
The good news is that you dont't cough immediately about the use of a negative indent...

Why pixels? I use them usually for margins because:

Quote:
The px unit is the magic unit of CSS. It is not related to the current font and usually not related to physical centimeters or inches either. The px unit is defined to be small but visible, and such that a horizontal 1px wide line can be displayed with sharp edges (no anti-aliasing). What is sharp, small and visible depends on the device and the way it is used: do you hold it close to your eyes, like a mobile phone, at arms length, like a computer monitor, or somewhere in between, like an e-book reader? The px is thus not defined as a constant length, but as something that depends on the type of device and its typical use.
Indeed I made an exception for the paragraph style "Chanson", where I used a percentage for no particular reason in fact or just easier testing.

Last edited by roger64; 07-11-2018 at 11:40 AM.
roger64 is offline   Reply With Quote
Old 07-11-2018, 12:24 PM   #14
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 6,777
Karma: 62512628
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, and NookColor. 2 Droid, 1 Win8 ePUB rdrs
Quote:
Originally Posted by roger64 View Post
The good news is that you dont't cough immediately about the use of a negative indent...
We've used them. Sometimes, it's fairly unavoidable. It's as good a solution as any, really. (The better solution would have been to discuss this with the client, and explain, and make THEM compromise, but I've worked with poets, so I know how that is.)

Quote:
Why pixels? I use them usually for margins because:



Indeed I made an exception for the paragraph style "Chanson", where I used a percentage for no particular reason in fact or just easier testing.
Hmmmmm....I'm going to have to contemplate this for a bit. I have some vague recollection of a very real-world issue around px and margins, but of course, can I think of it? NO. Senile old bat that I am. But I'll remember, sooner or later. :-)

Hitch
Hitch is offline   Reply With Quote
Old 07-16-2018, 10:37 PM   #15
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 4,807
Karma: 21644862
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Aura One, Aura H2O, Aura HD, Nexus 7 HD, iPad Air, Tolino epos
Quote:
Originally Posted by Hitch View Post
Hmmmmm....I'm going to have to contemplate this for a bit. I have some vague recollection of a very real-world issue around px and margins, but of course, can I think of it? NO. Senile old bat that I am. But I'll remember, sooner or later. :-)

Hitch
One issue with using px for margins is that moving between devices with different resolutions does not work very well. On an 600 pixel wide screen, 10 pixels is a lot wider than 10 pixels on a 1404 pixel wide screen. The referenced web page claim that a px is a constant 1/96 of an inch and not the same as a pixel does not seem to apply on any ereader I've used. Otherwise, I wouldn't have needed to waste the time that I have wasted changing image formatting from px to % so the amount of screen space used is relatively constant on my collection of ereaders. A 600px x 800px image is not 6.25" x 8.33" on any device I've used from a 5" Kobo Mini to a 10.5" iPad Pro.

Last edited by DNSB; 07-16-2018 at 10:51 PM.
DNSB is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Poetry roger64 ePub 7 02-11-2014 10:37 AM
Just Poetry newone Self-Promotions by Authors and Publishers 0 04-02-2012 01:34 PM
Anyone for poetry? Graham Coulson Lounge 1 10-08-2011 06:02 AM
Got POETRY? Dr. Drib Writers' Corner 36 04-02-2009 11:18 AM


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


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