View Single Post
Old 01-01-2016, 05:13 AM   #24
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,635
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Drop Cap for Kindle (all models)

Quote:
Originally Posted by Hitch View Post

I love Ruben, but that formatting is going to go straight to hell the moment someone with Coolreader opens it. And it won't survive the Kindle process, either, for KF7, I don't think. Or KF8, given the line-height requirement.

Hitch
Hi Hitch;

Happy New Year Yes, you are right, but in CoolReader nothing works, since it doesn't support "float" and many others css2 properties. Regarding Kindle, well, that's an interesting case. Sometime ago (about two years) I spent a lot of time trying to find a way to get a perfect drop cap with any Kindle device (e-ink or Fire models), with any font size, with any font family (with Kindle e-inks you have six fonts to choose). I wanted something consistently displayed, regardless of device used. Could that be possible? After lots of trial and error, I found the only way to get that target was with an image, so I decided to employ a SVG image. With the following code you can get a perfect drop cap for all Kindle models (forget for the moment KF7):

Code:
/* Style to set the grey square */
.KDropSpace {
    float: left;
    font-size: 4.6em;
    width: 1em;
    height: 1em;
    background: grey;
    padding: 5px;
    margin: 0 5px -0.1em 0;
}

/* Style to fit the DropCap inside the grey square */
.KSVGDropCap {
    display: block;
    position: relative;
    top: 0em;
    left: 0.05em;
    font-size: 1.2em;
    font-weight: bold;
    font-family: sans-serif;
    width: 0.8em;
    height: 0.8em;
    text-align: center;
}

/* Styles for old Kindle models */
@media not amzn-mobi {
.NotKF8 {
    display: none;
}
}
And in the .xhtml file:

Code:
<h1>SVG Drop Cap for Kindle</h1>

  <p><span class="KDropSpace"><img alt="B" class="KSVGDropCap" src="../Images/B.svg" /></span><span class="NotKF8"><b>B</b></span>ehind the walls of Augustine,<br />
  he notes the seven traits of plants<br />
  and how their combinations<br />
  tell us that what was shall surely be<br />
  again. He writes of <i>dominance</i><br />
  and <i>recession</i>, of the patterns</p>
These are screenshots of Kindle Previewer for all Kindle models:

Click image for larger version

Name:	Image1.png
Views:	298
Size:	68.3 KB
ID:	145143 Click image for larger version

Name:	Image2.png
Views:	335
Size:	56.9 KB
ID:	145144 Click image for larger version

Name:	Image3.png
Views:	294
Size:	47.3 KB
ID:	145145 Click image for larger version

Name:	Image4.png
Views:	268
Size:	46.8 KB
ID:	145146 Click image for larger version

Name:	Image5.png
Views:	277
Size:	50.1 KB
ID:	145147

Below you can check the respective epub, with the SVG image for the letter "B". Regarding KF7, you know, we can't get there drop caps, so I displayed the first letter as bold.

Regards
Rubén
Attached Files
File Type: epub DropCap for Kindle.epub (3.3 KB, 195 views)

Last edited by RbnJrg; 01-01-2016 at 05:25 AM.
RbnJrg is offline   Reply With Quote