View Full Version : embedded font - now line with embedded font not re-flowing


Kaylee Skylyn
08-01-2012, 05:24 PM
See next post. Still having problems when font removed.

So I finally got my embedded font to work ok. (validator found no errors in ePUB, yay! Almost took a screenshot of that....) but after all that I found that the lines using the font are continuing off the page and are not wordwraping...so not reflowing. I was sure I saw this issue mentioned while researching the embedding of fonts (and ignored at the time because I just wanted the fonts to embed in the first place) but now can't find said reference. Not using the right search words maybe....

Anyone know why this would happen and how to fix? (please tell me it can be fixed!)

I'm using Fontin SmallCaps in a span...first line of the chapter.

Kaylee Skylyn
08-01-2012, 11:54 PM
Update: Seems that it likely is unrelated to the embedded font.

Looks like it has to do with the span.

I have an image drop cap and want the first line to be snug to the image so have a span to do that... I removed the font, changed the first line to capital letters but left the span to snug the letter and the line still not word wrapping...

span causing the issue (after fonts removed);
CSS:
span.lettrine {float: left; margin: 0 0.5em -0.1em 0.25em; }

span.firstline {margin-left: -1em; white-space: pre; }

img.h {height: 12em; max-height: 325px;}

HTML:
<p>
<span class="lettrine"><img class="h" alt="Drop cap H" src="images/KnotH.jpg" /></span>
<span class="firstline">ARLEY FOUND THE LIZARD.</span> &nbsp;Only Harley could have, because he was the only one big enough and curious (or stupid) enough to push through the brambles guarding the ravine behind their new place. They&rsquo;d moved to Kansas in January, halfway through the school year, and it sucked. It was spring break and all his friends were back in Texas, so Jared had nothing to do for fun but walk his dogs along the wooded ravine and hope that the <em>Texas Chainsaw Massacre</em> hadn&rsquo;t actually taken place in Kansas.</p>

In this case (first chapter) its short enough that it wasn't noticeable but in later chapters the span covers a whole line and half of it is not readable.

Toxaris
08-02-2012, 03:06 AM
The problem is that you have no way to determine what is the first line. It depends on the font size, page layout, etc. There are CSS attributes for firstline but those are ignored by most readers and they are not in the format specifications of the ePUB format.

Jellby
08-02-2012, 04:53 AM
There are CSS attributes for firstline but those are ignored by most readers and they are not in the format specifications of the ePUB format.

The spec says:

Reading Systems must support all CSS2 selectors, including pseudo-elements and pseudo-classes

and this includes :first-letter and :first-line, so they are in the ePub spec, which doesn't mean they are supported by popular readers :rolleyes:

What is not supported is the text-transform property that one would like to use in this case. What I'd do is choose one of:

1) Use :first-line and text-transform regardless of their support status. It's not grave if they don't work now, it's a purely aesthetic formatting that doesn't add anything significant. In some future they'll work, or they'll be easily converted to something that works.

2) Hardcode as uppercase letters (or as smallcaps) only the first word (or the first two words, if the first one is one-letter). This doesn't change when the font size or text width are changed, and doesn't look wrong.

Toxaris
08-02-2012, 05:11 PM
I stand corrected. I was under the assumption that pseudo classes and first-line and first-character were not in the specifications.

Kaylee Skylyn
08-02-2012, 06:10 PM
Thanks guys.

I wasn't intending to use the pseudo-class 'first-line' (because that could only be used on the 'p' not the span correct?) that was just the identifier I used to identify the span. So bad choice there I suppose. I just wanted the span to identify a set of words that would have the smallcaps applied to them. Not necessarily to be the first line only (in some cases it was more sometimes less than the first line even in the original format.)

I did consider just using the smallcaps on the first word only but didn't like the look. I may have to do that though if I want to use the font...

For now I put them in all capital letters just so the text would reflow.

Meh.
Meh, I say.

Hitch
08-02-2012, 09:55 PM
The spec says:

Reading Systems must support all CSS2 selectors, including pseudo-elements and pseudo-classes

and this includes :first-letter and :first-line, so they are in the ePub spec, which doesn't mean they are supported by popular readers :rolleyes:

What is not supported is the text-transform property that one would like to use in this case. What I'd do is choose one of:

1) Use :first-line and text-transform regardless of their support status. It's not grave if they don't work now, it's a purely aesthetic formatting that doesn't add anything significant. In some future they'll work, or they'll be easily converted to something that works.

2) Hardcode as uppercase letters (or as smallcaps) only the first word (or the first two words, if the first one is one-letter). This doesn't change when the font size or text width are changed, and doesn't look wrong.


If I can kibbitz a bit:

First, I have found that :first-letter and :first-line are largely unsupported; although I can get it to work some of the time, I can't get it to work consistently enough to be usable for a commercial book. Jellby, I think you and I just traded some discussion about this somewhere else, but I don't remember where, AND, more importantly:

@kaylee:

If you try to use a dropcap with a span of smallcaps, it won't work at ALL, on the Nook. I do see that your dropcap isn't actual text, but an image, but I don't believe that will change anything; we tried this about a year ago for a client, and went through more revisions than I can express, but with Nook's specs, it simply won't work. If you don't set hyphenation off, it will do very bizarre things like place the text of the second span vertically on a page; if you do turn hyphenation off, the text will--as happened with you--run the text inside the span off the right-margin. For whatever reason, it just doesn't bloody work. Or, at least, it wasn't workable a year ago, and I doubt that Nook has upgraded anything that would change that in the last 9-12 months. We must have tried 18 different versions of that, but nothing worked. It's not the first-line or first-letter thing; it's the two spans.

Of course, if anyone can get it to work on a Nook, it might be Jellby, but nothing we tried worked, our client had to settle for simple caps that we entered manually, no spans, no text-transform, no smallcaps.

HTH,
Hitch

JSWolf
08-02-2012, 10:07 PM
a pre will cause text to flow past the margin instead of wrap. So in

span.firstline {margin-left: -1em; white-space: pre; }

The pre has to go.

.firstline {
margin-left: -1em
}

Jellby
08-03-2012, 03:58 AM
I just wanted the span to identify a set of words that would have the smallcaps applied to them. Not necessarily to be the first line only (in some cases it was more sometimes less than the first line even in the original format.)

That's fine then (but possibly ugly). If you want smallcaps, you should add "font-size: 85%" or so to the span's style (or use "font-variant: smallcaps" and write lowercase letters, but this won't work in most devices).

But, with your code, the uppercase text is never more than the first line since, as JSWolf says:

a pre will cause text to flow past the margin instead of wrap.

Remove the "white-space: pre" (and the &nbsp;) and it should be fine, barring bugs in a reader.

Kaylee Skylyn
08-03-2012, 05:42 PM
Ah! Thanks! I didn't realise the pre would do that. I will try removing it.

And ya, I understood that "font-variant: smallcaps" was not supported by most readers so was avoiding using it.

Thanks for all the comments everyone.
I'll play around with it some more. Once I remove the 'pre' I may post here for those with a Nook to try. Hopefully the image dropcap would at least show up as an image...

JSWolf
08-03-2012, 05:52 PM
That's fine then (but possibly ugly). If you want smallcaps, you should add "font-size: 85%" or so to the span's style (or use "font-variant: smallcaps" and write lowercase letters, but this won't work in most devices).

Actually, I believe that simulated smallcaps should be 75% or .75em.

Jellby
08-04-2012, 03:17 AM
Actually, I believe that simulated smallcaps should be 75% or .75em.

That depends on the font, even the kpfonts (http://www.tex.ac.uk/tex-archive/fonts/kpfonts/doc/kpfonts.pdf) LaTeX package offers two different sizes of true smallcaps.

Hitch
08-04-2012, 07:56 PM
That depends on the font, even the kpfonts (http://www.tex.ac.uk/tex-archive/fonts/kpfonts/doc/kpfonts.pdf) LaTeX package offers two different sizes of true smallcaps.

Jellby:

Sorry, I can't seem to find that thread, if I'm remembering it correctly--did you tell me that you got the pseudo-elements of first-line and first-letter to work in ADE/Nook, is that right? Without explicit marking via spans, etc.?

Hitch

Jellby
08-05-2012, 04:19 AM
did you tell me that you got the pseudo-elements of first-line and first-letter to work in ADE/Nook, is that right?

No, I didn't... I don't have a Nook, and I (almost) never try ADE on the PC. I believe I tried first-letter some time and it didn't work on my reader (probably my previous Gen3). But maybe it worked, and I decided not to use it anyway (because I want more control on the format of punctuation preceding the first letter).

Maybe I should add :first-letter and :first-line to the ePub reader test (http://wiki.mobileread.com/wiki/EPub_Reader_Test)...

mmat1
08-05-2012, 04:25 AM
For now I put them in all capital letters just so the text would reflow.


Whats about this "white-space: pre;" ? If i understood correctly then this could cause problems with the reflow.

Hitch
08-05-2012, 05:19 AM
No, I didn't... I don't have a Nook, and I (almost) never try ADE on the PC. I believe I tried first-letter some time and it didn't work on my reader (probably my previous Gen3). But maybe it worked, and I decided not to use it anyway (because I want more control on the format of punctuation preceding the first letter).

Maybe I should add :first-letter and :first-line to the ePub reader test (http://wiki.mobileread.com/wiki/EPub_Reader_Test)...

Hi:

I could swear that somewhere, in one of the discussions, either here or over on the Sigil list, someone said that they had, and I was trying to follow up. I thought it might be you, but obviously not. It works fine in iPad--but I haven't had any luck getting it to work in ADE or Nook; I discussed this with Liz C. about a year ago (?), and she said she hadn't at the time, but if someone here had, I thought I'd inquire. Thanks anyway, Jellby.

Hitch

Toxaris
08-05-2012, 06:18 AM
I can't remember reading that and I think I would. It would be great if it was supported...

JSWolf
08-06-2012, 01:55 PM
Hi:

I could swear that somewhere, in one of the discussions, either here or over on the Sigil list, someone said that they had, and I was trying to follow up. I thought it might be you, but obviously not. It works fine in iPad--but I haven't had any luck getting it to work in ADE or Nook; I discussed this with Liz C. about a year ago (?), and she said she hadn't at the time, but if someone here had, I thought I'd inquire. Thanks anyway, Jellby.

Hitch

You cannot just specify the iPad as a reader. You have to specify which app you are using with the iPad. The iPad is not just iBooks. It's also got Bluefire Reader (better then iBooks).

Hitch
08-07-2012, 03:13 AM
You cannot just specify the iPad as a reader. You have to specify which app you are using with the iPad. The iPad is not just iBooks. It's also got Bluefire Reader (better then iBooks).

Wolfie:

When I say "iPad," I only mean iBooks. I'm not testing somewhat obscure (to my clientele) reading apps.

Hitch

JSWolf
08-07-2012, 05:36 PM
Wolfie:

When I say "iPad," I only mean iBooks. I'm not testing somewhat obscure (to my clientele) reading apps.

Hitch

Then say iBooks. iPad is a generic term and can mean any number of reading apps. Blurefire is not obscure as it uses ADE and I've not seen anything fail in Bluefire that ADE for Windows handles correctly.

Hitch
08-08-2012, 03:15 AM
Whatever. I think I was clear in saying "...obscure (to my clientele) reading apps."

Hitch

Jim Lester
08-09-2012, 10:09 AM
Whatever. I think I was clear in saying "...obscure (to my clientele) reading apps."


I think JSWolf was stating that since we are not (or at least I don't think we are) your clientele, a little more precision in your state would help us out understanding what you meant :)


(going back to play with docs to see if the latest version of RMSDK will respect :first-letter)

JSWolf
08-09-2012, 10:19 AM
Many people say the iPad has problems with eBooks when it's not the iPad but the iBooks app that has the problems. It just causes confusion and is not actually correct.

Hitch
08-09-2012, 07:30 PM
I think JSWolf was stating that since we are not (or at least I don't think we are) your clientele, a little more precision in your state would help us out understanding what you meant :)


(going back to play with docs to see if the latest version of RMSDK will respect :first-letter)

Wow! A Wolf interpreter. You are most welcome here, as many of us have longed for such a thing for forever. ;-)

If you can get:


first-letter
first-line
and, while I'm wishing, a raised initial span adjacent to a smallcaps span to work in ePUBs on Nook,


You can interpret all you want! I know I'd be ecstatic, myself, I'm sick of making two ePUBs for a book that should not be needed. It's pesky that even KF8 will use it, although obviously not KF6/7, but NOT Nook, which of course is a big part of the market.

Hitch