View Single Post
Old 01-27-2012, 10:18 AM   #79
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 2,833
Karma: 4199513
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"/AuraH2O
Quote:
Originally Posted by Morkl View Post
Do you have font-variant: small-caps definitions that work on the PRS-T1? Care to share?
If you were expecting an elegant 'solution' look away now The font-variant property just doesn't work in the ADE reader so a workaround was necessary.
My main aim was to correctly display SmallCaps in epubs created from my own HTML/CSS files which are written like
Code:
HTML file: <p>...<span class="smallcaps">this text displays in SmallCaps</span>...</p>
CSS file: .smallcaps {font-variant: small-caps}
For this very specific case, including this in css/style.css does the trick
Code:
@font-face {font-family: "SCfont"; font-weight: normal; font-style: normal; src: url(res:///ebook/fonts/../../mnt/sdcard/reader/fonts/xxx.ttf)}
@font-face {font-family: "SCfont"; font-weight: normal; font-style: italic; src: url(res:///ebook/fonts/../../mnt/sdcard/reader/fonts/xxx-Italic.ttf)}
@font-face {font-family: "SCfont"; font-weight: bold; font-style: normal; src: url(res:///ebook/fonts/../../mnt/sdcard/reader/fonts/xxx-Bold.ttf)}
@font-face {font-family: "SCfont"; font-weight: bold; font-style: italic; src: url(res:///ebook/fonts/../../mnt/sdcard/reader/fonts/xxx-BoldItalic.ttf)}

.smallcaps {font-family: "SCfont", serif; font-variant: normal}
However, in commercial epubs I've rarely (if ever) seen .smallcaps {font-variant:small-caps} in the CSS file. It's much more likely to be .smallcaps {font-size:0.75em} with the relevant text in the HTML file already in UPPERCASE.

The crude solution above should still work to use the specified SmallCaps font but the biggest problem is that they rarely use an obvious descriptive name like smallcaps as the css selector name. I've settled on the following in my style.css
Code:
.smallcaps, .smallcaps1, .smallcaps2, .small-caps, .sc, .fsc, .smallCaps, .Smallcaps, .SmallCaps {
    font-family: "SCfont", serif;
    font-variant: normal}
It still doesn't catch all of them, but those that are missed are still displayed as font-size 0.75em in the standard body text font, i.e. the publisher's own crude work around.

Quote:
Originally Posted by Morkl View Post
...or I could just redefine the nomenclature, and make the "Font selector" a "Style selector" ...

So, which way do you think would be the best?
Simple is good. The 'make the "Font selector" a "Style selector"' option would suit me. You would have your choice of 7 .css files. Infinite is better, but may not be worth your time and effort. Speaking for myself only, your custom Font Sizes feature has greatly reduced the number of CSS files I need.

Quote:
Originally Posted by Morkl View Post
Pros: CSS selector integrated in the Reader that remembers the setting for each book
Very easy to implement
I like the book 'remembered setting' feature. We didn't have that with PRS+ and the earlier Sony models.

Quote:
Originally Posted by Morkl View Post
Cons: CSS files need to be kept for each style
Not much of a Con for PRS+ users. We've always done it this way. Creating your first CSS file is the hardest. It's mainly copy/paste with minor tweaks for the rest.
jackie_w is offline   Reply With Quote