![]() |
#1 |
Browser
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 745
Karma: 578294
Join Date: Apr 2010
Location: Australia
Device: Kobo Touch, Kobo Aura HD
|
Drop Cap coding help, please
Hi all, I'm trying to get the knack of drop caps in epubs. I thought I'd cracked it, because the following code works well in both Sigil and ADE, but it goes a bit bizarre on both my Kobos.
What I'm using is: Code:
.C_DropCap { font-family: "Palatino Linotype"; font-weight: bold; font-size: 420%; overflow: hidden; float:left; margin-top: -0.17em; margin-bottom: -0.30em; margin-right: 0.05em; } Can anyone help me understand why, and suggest how to fix the code? (I know, I can just play around with settings until it works, and I'm willing to do that; but I'm not proficient at CSS, so I'd also like to understand why this is happening. Or does Kobo's renderer just not support drop caps?) |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,251
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
I don't have any definitive answers for you, but this is the simple css I've been using lately for both my Kobos:
Code:
.dropcap{ float:left; font-size:3em; font-weight:bold; line-height:0.8em; margin-right:0.05em; margin-top:-0.1em; } I'd be surprised if your setting of font-family: "Palatino Linotype"; was doing anything unless you have embedded the Palatino font inside the epub and you have also added the necessary @font-face statements to the css. I normally make the dropcap display in the same font as the rest of the paragraph by not including the font-family: at all. Last edited by jackie_w; 08-08-2013 at 08:40 PM. Reason: added pic |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,747
Karma: 168959600
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Here's what I'm using for dropcaps. Likely not the best solution but it works for the few times I use dropcaps.
Code:
span.dropcap { display: inline-block; float: left; margin-right: 0.1em; font-size: 3.2em; line-height: 0.75em; } span.dropcap2 { font-size: 400%; font-weight: bold; line-height: 1; height: 1em; float: left; margin: -0.1em 0.125em -0.1em 0.25em; } Code:
.lettrimg { float: left; margin: 0 0.5em -0.1em 0.25em; } <div class="lettrimg"><img alt="Y" src="../Images/Y.gif" /></div> <p class="paranon">ou can not know.</p> The top part of the letter missing is likely due to your choice to hide parts of the letter that overflow the display space. Change overflow: hidden to overflow: visible to see those missing bits -- or just remove the overflow: line as visible should be the default. Regards, David Last edited by DNSB; 08-08-2013 at 08:42 PM. |
![]() |
![]() |
![]() |
#5 |
Browser
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 745
Karma: 578294
Join Date: Apr 2010
Location: Australia
Device: Kobo Touch, Kobo Aura HD
|
Thanks for the replies, folks.
Jackie_w, yeah, the Palatino is embedded. I currently like to embed a chosen font for headings, and let the device choose the font for body text. I decided to use the headings font for the drop cap as well. That bit all works fine. Otherwise, I think our codes are essentially the same? Difference of bottom margin (which I added so the text wraps at the bottom of the drop as well) and the "hidden" code. I still don't understand why the code works on ADE and Sigil but not Kobo. David, thanks for your stuff. I considered embedding graphics for the dropped caps, but it does swell the filesize of the book considerably, and of course it's not subject to changes in font size at the device level. May be the only way to do it reliably, I guess. Geoff, thanks for the suggestion, mate. I'll check out a Feedbook or two, though if I remember correctly, the last time I looked at one of those the CSS made my head swim. ![]() |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
You should also have a look in the epub section of the forum. There have been a few threads dedicated to drop caps. But, I can't remember if anyone had a Kobo specific suggestion.
|
![]() |
![]() |
![]() |
#7 |
Browser
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 745
Karma: 578294
Join Date: Apr 2010
Location: Australia
Device: Kobo Touch, Kobo Aura HD
|
Yeah, I went there first of course, and then posted here specifically because it's only on my Kobo I can't get drop caps to work.
Last edited by MacEachaidh; 08-09-2013 at 02:35 AM. |
![]() |
![]() |
![]() |
#8 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
I should have known
![]() I tried your code and it didn't work. As I know I have seen it work in the past, I hunted through my books but couldn't quickly find one with drop caps. But my search of the epub threads found https://www.mobileread.com/forums/sho...867#post328867. That one does work. But, looking at the code, I have no idea why. |
![]() |
![]() |
![]() |
#9 | |
Browser
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 745
Karma: 578294
Join Date: Apr 2010
Location: Australia
Device: Kobo Touch, Kobo Aura HD
|
Quote:
I've looked through quite a few, and none of them seem to have them. Unless maybe they used to, but have adopted a new stylesheet. If you can name any, I'd be grateful. Anyway, maybe I should just change my mind about my formatting. ![]() |
|
![]() |
![]() |
![]() |
#10 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 602
Karma: 641742
Join Date: Mar 2012
Location: DE
Device: Kobo Glo
|
Quote:
It depends on (a combination) of font family, font size, line height. Might even be device/vendor specific, which font foundry created the font, font version number (may have different or revised font metrics). Dropcaps look good but, in general, only look good on your own device at a specific line height, font size and font family. |
|
![]() |
![]() |
![]() |
#11 |
Browser
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 745
Karma: 578294
Join Date: Apr 2010
Location: Australia
Device: Kobo Touch, Kobo Aura HD
|
Yeah, I can understand it would depend on the Caps height and x height written into the font, the ascender line relatve to the actual size of the glyph, but I would have thought that that could be addressed through the margin settings, and that if anything using an embedded font for the dropped cap, and calibrating the display to that, would if anything improve the likelihood of success.
If I were making a commercial epub, or one that needed to function on a device other than my Kobo, then I'd probably do what David (DNSB) suggested and embed graphics for the dropped caps. I accept what you're saying, Anak, but I'd still like to try to get it to work. It doesn't seem to me like it should be so problematic; it should be a lot more straightforward, don't you think? |
![]() |
![]() |
![]() |
#12 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,251
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
The problem with that would be that a graphic which displays as a 'nice size' on a 600x800 screen (e.g. Kobo Touch) will look puny on an Aura and vice versa. One that looks good on the Aura will be a monster on the Touch.
|
![]() |
![]() |
![]() |
#13 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
|
Quote:
|
|
![]() |
![]() |
![]() |
#14 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,747
Karma: 168959600
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Code:
<p class="cap noindent"><span class="dcap"><span class="dropcap">T</span>HE QUIET VOICE</span> so removing the non-existent, I got: Code:
<p class="noindent"><span class="dropcap">T</span>HE QUIET VOICE Code:
span.dropcap { font-size: 300%; font-weight: bold; float: left; margin: -0.1em 0.125em -0.2em 0em; text-indent: 0em; line-height: 1em; height: 1em;} Regards, David |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Drop cap bug on Paperwhite | dgatwood | Kindle Formats | 11 | 04-10-2014 04:14 AM |
To cap or not to cap | WT Sharpe | Calibre | 2 | 04-07-2012 03:45 PM |
Introducing Cap'n Jack | Capjack | Introduce Yourself | 6 | 05-21-2011 11:49 AM |
If the cap fits? | JJHamster | Amazon Kindle | 7 | 09-06-2010 06:22 PM |
Using CSS in Word to make a Drop Cap work in an Epub | brewt | ePub | 3 | 01-31-2009 06:00 PM |