View Full Version : smallcaps how to?


JSWolf
09-17-2009, 12:33 PM
How would I use a smallcap font in an ePub file? Thanks!

Jellby
09-17-2009, 12:55 PM
Use "font-variant: small-caps"

... and a reader other than Adobe's :rolleyes:

Other than that, you'd have to fake them by hardcoding the caps and using a smaller font-size:

<span style="font-variant: small-caps">Real smallcaps</span>

F<span style="font-size: 80%">AKED SMALLCAPS</span>

JSWolf
09-17-2009, 01:00 PM
The font is a smallcaps font already. I just want the ePub to use it.

Jellby
09-17-2009, 01:26 PM
Then I guess it's the same as with any other font, at most you'd have to specify the font-variant in the @font-face. You need to define the font in the CSS:

@font-face{
font-family: "My smallcaps font";
font-variant: small-caps;
src: url("../relative/path/to/the/font.ttf") format("truetype");
}

body {
font-family: "My smallcaps font";
}

Then you have to include the font.ttf file in the epub and add the corresponding line to the <manifest>.

JSWolf
10-01-2009, 09:16 AM
Ok, I've got small caps sorted. But one thing you have to do is convert the uppercase of the small caps to lowercase or it just looks like all uppercase. When a book does smallcaps, it just uses some small font size of all caps. So just setting the font does not work. You also have to convert the words to lowercase or upper/lower.

Jellby
10-01-2009, 12:06 PM
Yes, of course :smack:

You could use text-transform:lowercase, if it were supported, but that wouldn't work if there are real uppercase letters mixed with the smallcaps.

bentleymaniac
05-24-2016, 01:48 AM
text-transform:capitalize; ought to make the first letter of each word capital and every other letter lower case.

:facepalm: sorry, just realised that this thread was rather old...

Toxaris
05-24-2016, 04:35 AM
text-transform:capitalize; ought to make the first letter of each word capital and every other letter lower case.

:facepalm: sorry, just realised that this thread was rather old...

Not only that, it will not work on ePUB2.

mattmc
05-31-2016, 12:47 AM
Not only that, it will not work on ePUB2.

Nor will it be "true" smallcaps. The only way to accomplish true smallcaps are by using a smallcaps font.

doubleshuffle
05-31-2016, 01:24 AM
All right, now this dead thread is up and walking, we may as well feed it some brainz:

I think I know about all the (im)possibilities of doing smallcaps in epub2; but I have never bothered to find out if they have made it any easier in epub3. Have they?

Toxaris
05-31-2016, 02:41 AM
All right, now this dead thread is up and walking, we may as well feed it some brainz:

I think I know about all the (im)possibilities of doing smallcaps in epub2; but I have never bothered to find out if they have made it any easier in epub3. Have they?

It is format irrelevant I am afraid. All the right tools and possibilities are there for ePUB2. After all, the font-variant small-caps is part of CSS2. However, almost all readers have decided not to add a small-caps variant for their included fonts. So, it is not the format, but the support that is failing.
There are more styling options for ePUB3, but if they are not supported by the manufacturers...

pdurrant
05-31-2016, 07:50 AM
Nor will it be "true" smallcaps. The only way to accomplish true smallcaps are by using a smallcaps font.

It will be true smallcaps if the software displaying the ePub uses true smallcaps from the font, as it should if it is available.

The lack of smallcaps support is entirely an implementation problem, rather than a standards one.

doubleshuffle
05-31-2016, 08:02 AM
It will be true smallcaps if the software displaying the ePub uses true smallcaps from the font, as it should if it is available.

The lack of smallcaps support is entirely an implementation problem, rather than a standards one.

It should work like this, I think: I install a font with a smallcaps variant on my reader (so that I don't just have regular, bold and italic, but also smallcaps as a fourth font file) and then, when I put "font-variant: smallcaps" in the stylesheet for a class of text, that text should be displayed in smallcaps. And that is what doesn't work.

Am I getting this right?

pdurrant
05-31-2016, 09:26 AM
It should work like this, I think: I install a font with a smallcaps variant on my reader (so that I don't just have regular, bold and italic, but also smallcaps as a fourth font file) and then, when I put "font-variant: smallcaps" in the stylesheet for a class of text, that text should be displayed in smallcaps. And that is what doesn't work.

Am I getting this right?

Yes. The problem is that ADE ignores the font-variant attribute, although it's required to support it according the ePub standard. (See section 3.4 of the 2.0.1 specs (http://www.idpf.org/epub/20/spec/OPS_2.0.1_draft.htm#Section3.4).)

ADE is also really bad at supporting selectors. See Section 3.1 (http://www.idpf.org/epub/20/spec/OPS_2.0.1_draft.htm#Section3.1)

It ought to be really simple to specify that the first line of the first paragraph be in smallcaps, with the first letter bold and twice normal size.

But ADE doesn't support first-line or first-letter.

dwig
05-31-2016, 12:12 PM
Nor will it be "true" smallcaps. The only way to accomplish true smallcaps are by using a smallcaps font.

Which the OP said he was using.

@JSWolf: I would think a simple font declaration in the CSS for a styled SPAN in combination with embedding the smallcaps font would work just fine. It should work much like the tags for bold and italic. It would work for any format/device that supported custom fonts and would gracefully fall back to C/LC when either the format lacked support for embedded fonts or the user disabled the use of embedded fonts in their reader.

JSWolf
05-31-2016, 12:32 PM
Which the OP said he was using.

@JSWolf: I would think a simple font declaration in the CSS for a styled SPAN in combination with embedding the smallcaps font would work just fine. It should work much like the tags for bold and italic. It would work for any format/device that supported custom fonts and would gracefully fall back to C/LC when either the format lacked support for embedded fonts or the user disabled the use of embedded fonts in their reader.

You do know that you are answering a question from 2009 and it's 2016 now.

dwig
05-31-2016, 01:47 PM
You do know that you are answering a question from 2009 and it's 2016 now.

Yes, but it was dusted off and brought forward will a lot of additional discussion that seemed to be taking a tangential direction so I was inclined to comment, more for lurkers and for you in particular as I would have expected you to have resolved this over a half decade ago.

JSWolf
05-31-2016, 02:12 PM
Yes, but it was dusted off and brought forward will a lot of additional discussion that seemed to be taking a tangential direction so I was inclined to comment, more for lurkers and for you in particular as I would have expected you to have resolved this over a half decade ago.

Yes, I have solved this long ago. I know a lot more about ePub now then I did back then.

Hitch
05-31-2016, 10:59 PM
Which the OP said he was using.

@JSWolf: I would think a simple font declaration in the CSS for a styled SPAN in combination with embedding the smallcaps font would work just fine. It should work much like the tags for bold and italic. It would work for any format/device that supported custom fonts and would gracefully fall back to C/LC when either the format lacked support for embedded fonts or the user disabled the use of embedded fonts in their reader.

MattMC was, if I am not wrong, commenting about Bentleymaniac's suggested solution using text-transform. He, MattMC, was correct when he said it wouldn't be a true smallcap. Even IF you could get that to work on ePUB2, which is still holding the day.

Not to wax poetic and all geezer-like, but there's an elegance to an actual smallcaps font variant that you simply don't get by squishing the full-size characters. This does not mean that we haven't all done it; gods know, I have, when I couldn't get a client to realize that the LookInside shouldn't be the driver for the layout, but...yowch. I don't like squishing.

Hitch

mattmc
06-02-2016, 03:20 PM
MattMC was, if I am not wrong, commenting about Bentleymaniac's suggested solution using text-transform. He, MattMC, was correct when he said it wouldn't be a true smallcap. Even IF you could get that to work on ePUB2, which is still holding the day.

Precisely. :)

It will be true smallcaps if the software displaying the ePub uses true smallcaps from the font, as it should if it is available.

The lack of smallcaps support is entirely an implementation problem, rather than a standards one.

For sure. I'm not aware of a single ereader that properly reads from the smallcaps portion of an OTF when given the font-variant instruction.

In my experience, your font has to have actual small-caps glyphs in the lowercase letter slots, for this to be pulled off on the broad range of ereaders we try to support these days.

JSWolf
06-02-2016, 03:40 PM
For sure. I'm not aware of a single ereader that properly reads from the smallcaps portion of an OTF when given the font-variant instruction.

In my experience, your font has to have actual small-caps glyphs in the lowercase letter slots, for this to be pulled off on the broad range of ereaders we try to support these days.

This is correct. Current Readers cannot get to the small-caps in an OTF font unless the small-caps have replaced the lowercase letters.

But some fonts do have a small-caps variant so you can use that to get true small-caps. I know some SIL fonts have small-caps built-in tot he OTF, but somewhere on the SIL sight, you can take the font families and make small-caps versions out of it.