prs-plus icon indicating copy to clipboard operation
prs-plus copied to clipboard

font-size through style.css is applied twice in nested items. (Example <span> inside <p>, or <p> inside <div>)

Open GoogleCodeExporter opened this issue 9 years ago • 2 comments

Your model / PRS+ version?
PRS-650 / Nightly 169 (although I think it's irrelevant).

What steps will reproduce the problem?
1. First of all maybe this issue is unavoidable but nevertheless I post it.

2. New forced styles through auto-generated 
database/system/PRSPlus/epub/style.css are applied twice for nested items (or 
even maybe more times). And this can be a problem with "font-size: 1.066em;" 
because each time you multiply by 1.066, so you end with 1.136 (or 1.211, ...)

3. As reference, I copy the whole css style I have right now:

div, div[class], p, p[class],  html, span, ol, ul, li, table, td, th, 
TheAntiquaB-W5Plain_95 {font-size: 1.066em !important;} /* MARKER MFONTSIZE 0*/


4. A real world example: in several recent books, instead of using <i>, <b> or 
<u> tags, text formatting is done through several <span> classes. So you have 
nested <span> tags within some their <p> paragraphs.

5. Another real world example. I don't know why but I've found books where you 
have <div> sections with <p> paragraphs inside them, but also <p> paragraphs 
without being inside any <div>.

6. Another real world example built by me:
6.1. Because of what I explain later, I usually edit my Spanish ebooks adding 
this css style: .nw {white-space: nowrap;}
6.2 And then I insert span tags in dialogues. I explain it in case you don't 
know that the typical <p>"Bla, bla, bla," John said.</p> English dialogue 
sentence would be written as <p>-Bla, bla, bla, -John said.</p> in Spanish. 
(Notice how " is more or less changed by -).
6.3 In order to avoid ugly line-wrapping between "-" and "John", I edit my 
Spanish ebooks and I change the previous sentence to <p>-Bla, bla, bla, <span 
class="nw">-John</span> said.</p>.

7. In any of these situations, you get mixed final font sizes. And the final 
looking is specially ugly in 4. and 6. examples because these different font 
sizes are located in the same sentence. 
Ok, I know how to fix it in 6., (.nw {white-space:nowrap; font-size:1em;}), but 
4. will lead to horrible formatting for the average user who doesn't have to 
know how to edit/fix the epub file.



What is the expected output?
I'm no expert so maybe there's some kind of drawback in the next suggestion. So 
please check it with care.

Instead of applying font-size to "p, div, ..." individually, why don't you 
apply it just to "body"? As font-size is inherited, you'll change the full book 
font-size in just one step (except if body has a pre-set font-size in a css 
style, but this trouble also would happen with p or div).

Another good side effect you'd get: with current style.css setting you are not 
changing h1 through h6 tags, so you are currently scaling the font-size in all 
the ebook BUT the titles.

Original issue reported on code.google.com by [email protected] on 27 Dec 2012 at 8:59

GoogleCodeExporter avatar May 17 '15 10:05 GoogleCodeExporter