View Full Version : Dropcaps code wanted


JSWolf
08-31-2012, 09:12 AM
I know there are many ways to do drop caps in ePub via ADE. What code do you use or what code do you like the look of?

I'd like ot get as many different dropcaps code as possible so there would be a good choice of differing styles.

Thanks.

Jellby
08-31-2012, 10:19 AM
Simple but effective (not really "dropping", though):

span.drop {
font-size: 200%;
font-weight: bold;
line-height: 0;
}
span.predrop {
font-weight: normal;
font-size: 50%;
}
span.letter_T {
margin-right: -0.15em;
}

<p><span class="drop letter_T"><span class="predrop">&mdash;</span>T</span>oma!...</p>

The class "predrop" is used for anything preceding the first letter. It's better to include it inside the "drop" span, in case you want to change it to something else... like a float. I also create "letter_?" classes for each letter that might need adjustments (T, V... in this case; A, L... for real drop caps). A simpler example:

JSWolf
08-31-2012, 10:40 AM
All that is is a raised initial cap. Not a dropcap at all.

Jellby
08-31-2012, 11:06 AM
Yes, that's what I meant with not "dropping".

For a more elaborate (and really "dropping") cap, from "The Prince and the Pauper":

span.first {
font-variant: small-caps;
margin-left: -0.5em;
white-space: pre;
}
span.drop {
font-family: "Royal";
font-size: 500%;
line-height: 1;
height: 1em;
float: left;
margin: 0.1em 0.1em -0.2em 0;
}
span.afterA {
margin-left: -1.0em;
}
p.initial {
text-indent: 0;
}
p.initial + p {
clear: left; /*optional, depends on how you want the second paragraph if the first is short*/
}

<p class="initial"><span class="drop">A</span><span class="first afterA"> heavy</span> drowsiness presently fell upon the two comrades. The King said&mdash;</p>

roger64
08-31-2012, 11:15 AM
Hi

You'll find a code in this EPUB and some examples as well.
I also use a regex to place them. More by mail if you wish.

http://www.mobileread.com/forums/showthread.php?t=189203

ghostyjack
08-31-2012, 01:52 PM
I used the following for my Lovecraft books, it seemed to do the job.

p.newscene2 {
text-indent:0;
margin-top:2em;
}

span.dropcap {
float:left;
font-size:4.7em;
line-height:0.8em;
margin-right:3pt;
margin-bottom:-0.1em;
}

<p class="newscene2"><span class="dropcap">T</span>he first line</p>

Not the most sophisticated, but was good enough for my first ever book.

Jeff L
08-31-2012, 11:05 PM
I use this:

.dropcaps
{
float: left;
font-size: 60px;
line-height: 50px;
padding-top: 1px;
margin-top: -.04em;
margin-right: .04em;
}

Yes, I know it's in px.

brewt
09-04-2012, 07:45 PM
You know, I hate to say anything, especially since I've historically fussed so hard about it all. I've given up on drop caps. Too many places they just don't work out, like:

Chapter One
"Me?"
"Yes. You."


Chapter Two
I..I couldn't go on. Maybe another word or two. Note quite enough to sometimes make a second line before another paragraph.
That you are indenting everywhere else.
That you are indenting everywhere else.


Chapter Three
Aaah, the way it should be, with an initial paragraph that goes on long enough to wrap and look nice until another paragraph comes in somewhere down the road. This is what it works best on and is why we worked it all out to start with: we've seen enough great examples in print to make us want to do it here...


I know, my examples suck here, because they don't actually drop (you'll have to imagine them dropping). But unless I'm willing to be inconsistent, or snip out double or single quotes at the beginning, or live with how funny second paragraphs sometimes butt up against them when I can't quite control where things fall, I just keep running into too many situations where they just don't work, and I would have to justify yet another compromise. When they work, they are impressive. When they don't, they impressively don't.
Or, maybe rookie here just can't figure out how to make all possible textual situational variants work without scripting.
-b

JSWolf
09-04-2012, 08:26 PM
But you can control how drop-caps work.

roger64
09-05-2012, 02:27 AM
Hi

This time, a try with drop-caps on two lines. Looks OK including for "tricky" J and Q initials. :)

http://www.mobileread.com/forums/showthread.php?p=2208445#post2208445

JSWolf
09-05-2012, 10:56 AM
Hi

This time, a try with drop-caps on two lines. Looks OK including for "tricky" J and Q initials. :)

http://www.mobileread.com/forums/showthread.php?p=2208445#post2208445

Well, the drop-cap needs to be moved up slightly. The descender of the Q hits the top of the D on the third line. That is unacceptable.

brewt
09-05-2012, 11:00 AM
Yes, we can control how the drop cap works. What we cannot control so well is how the lines break around them, because the page width is an unknown in reflowable books. In the lovely Soyans Gais example, the AU CONCERT VATOIRE chapter, if you have your view the width set single-column full screen *might* show part of what I've talking about. The second paragraph (Il faut vous dire) starts with an indent, and can land on the second line of the drop cap. Sure, it changes to something more pleasant with a narrower width, but it happens often enough--at least, in the books I'm building, even on smaller screens--that it is bothersome. At least to me. That is something I don't seem to be able to find an acceptable solution for enough of the time (could be solved with scripting, maybe), which is what has led me to abandon the lovely things, with regrets.
But, don't let me stop anyone else. Because I do like dropcaps. Wish I were a clever enough typographer to make them work more often for the situations I so readily seem to keep running into. Dang it.
-b

roger64
09-05-2012, 11:29 AM
Well, the drop-cap needs to be moved up slightly. The descender of the Q hits the top of the D on the third line. That is unacceptable.

Thank you for looking at it and for pointing this. :)

This is easily corrected and will be memorized for the next time: for example, in the CSS style-sheet, using Sigil, just modify the let2 font-size value from the original 2.6 to 2.5 or maybe 2.4. Select the value which gives you the best results.

roger64
09-05-2012, 11:42 AM
.../In the lovely Soyans Gais example, the AU CONCERT VATOIRE chapter, if you have your view the width set single-column full screen *might* show part of what I've talking about. The second paragraph (Il faut vous dire) starts with an indent, and can land on the second line of the drop cap. .../...
-b

This can, sometimes be a problem, if you use indents. Statistically, with dropcaps on two lines you have much less chance to face this than with dropcaps on three lines. :-)

Also there is the question of the possible punctuation mark, just before the initial letter. Usually, I suppress it. It is also possible to include it in the initial. I've seen both. It's a matter of choice.

brewt
09-05-2012, 11:44 AM
This can, sometimes be a problem, if you use indents. Statistically, with dropcaps on two lines you have much less chance to face this than with dropcaps on three lines. :-)

Also there is the question of the possible punctuation mark, just before the initial letter. Usually, I suppress it. It is also possible to include it in the initial. I've seen both. It's a matter of choice.

Yes, and that is part of my problem: can't make a decision I'm ultimately happy with.
8^)

Jellby
09-05-2012, 01:19 PM
The problem with drop-caps, is that they require some individual tweaking, and that's only effective if you know the exact font, font size and page size... which goes against the ebook philosophy. Without font embedding and fixed layout, all solutions are only good-enough, and sometimes that's not enough. :D

Hitch
09-05-2012, 08:56 PM
The problem with drop-caps, is that they require some individual tweaking, and that's only effective if you know the exact font, font size and page size... which goes against the ebook philosophy. Without font embedding and fixed layout, all solutions are only good-enough, and sometimes that's not enough. :D

Ahhhhhhhhhhhh, Jellby:

Better to have dropped and lost then ne'er to ha' dropped a'tall. ;)

Hitch

roger64
09-18-2012, 02:17 AM
The problem with drop-caps, is that they require some individual tweaking, and that's only effective if you know the exact font, font size and page size... which goes against the ebook philosophy. Without font embedding and fixed layout, all solutions are only good-enough, and sometimes that's not enough. :D

I will certainly not argue with the fact that a successful dropcap implementation requires extra care and tweaking, including knowing the exact font used. I am not so sure why it would require a fixed layout even if it's true that a standard EPUB, with its ragged (non justified) text is not the nicest format to go along with drop caps.

But why argue about "ebook philosophy"? This is maybe going a little too far. After all, one of the features of EPUB3 is to allow a fixed layout for enriched texts. So, I cannot see why dropcaps should be condamned for philosophy or principle reasons. They are part of the game. Ragged text will disappear from the EPUBs of tomorrow long before the dropcaps do. :)

Further, two more twoliners exemples coming from a printed book with the "unaccceptable" Q behaviour (Q is often very tricky...) and a drop cap with a previous quote mark.

Jellby
09-18-2012, 04:34 AM
But why argue about "ebook philosophy"? This is maybe going a little too far. After all, one of the features of EPUB3 is to allow a fixed layout for enriched texts. So, I cannot see why dropcaps should be condamned for philosophy or principle reasons. They are part of the game. Ragged text will disappear from the EPUBs of tomorrow long before the dropcaps do. :)

For me, the "ebook philosophy" is to let the user change things like font, font size, line separation, margins... With this requisites, the use of dropcaps (and similar things, like figures around which the text wraps) is fragile, make some (maybe unusal) change to the font, screen size, etc. and you get undesirable results.

I don't say dropcaps should be proscribed, but this fact should be kept in mind when deciding whether or not to use them (and how).

Further, two more twoliners exemples coming from a printed book with the "unaccceptable" Q behaviour (Q is often very tricky...) and a drop cap with a previous quote mark.

The Q example is indeed unacceptable. A self-respected typesetter would never allow that, and would apply some tweaks to prevent the clash between the Q's tail and the i's dot (make the Q slightly smaller, change the word spacing a bit to move the i away...). The quote mark example is acceptable, although some might not like it.

DiapDealer
09-18-2012, 05:52 AM
even if it's true that a standard EPUB, with its ragged (non justified) text is not the nicest format to go along with drop caps.

Ragged text will disappear from the EPUBs of tomorrow long before the dropcaps do.
What does justified or ragged text have to do with "standard" ePub?

roger64
09-18-2012, 06:19 AM
What does justified or ragged text have to do with "standard" ePub?

Nothing :) but the standard nearly unavoidable implementation of this standard made by ADE forces it for our unwilling eyes, at least for the PRS-505 users like me a a lot of others, I suspect . One day, our display will be fine.

PDF display, for this point of view, is much more pleasant, though of course it has other well-known drawbacks.

JSWolf
09-18-2012, 07:32 PM
Nothing :) but the standard nearly unavoidable implementation of this standard made by ADE forces it for our unwilling eyes, at least for the PRS-505 users like me a a lot of others, I suspect . One day, our display will be fine.

PDF display, for this point of view, is much more pleasant, though of course it has other well-known drawbacks.

I highly doubt Sony will be upgrading ADE on the 505. The only way to get justified text via ADE is to get a newer Sony or a different brand reader.

roger64
09-19-2012, 02:31 AM
I highly doubt Sony will be upgrading ADE on the 505. The only way to get justified text via ADE is to get a newer Sony or a different brand reader.

I highly doubt it too. :) Not only justification is missing but also hyphenation, as I consider it to be also a standard feature.

Meanwhile, I recently learnt, thanks to Jellby's expert and friendly help, how to convert automatically cleanly formatted EPUB to PDF which can give me these above features to the exact format of my reader. Of course, it's not a replacement, just a workaround. So, if I wish, I can get now justification and hyphenation on my reader.

Throwing my still working reader to the rubbishbin is not yet an option. Though... :rolleyes: