Mobileread
Forcing old-style figures from a font in Kindle
#1  Enterio 03-05-2020, 03:40 PM
Is there any easy way to edit the CSS to force the Kindle to show
figures as old-style figures?

I have a solution, but it’s pretty radical. You’d have to find all the
figures or numbers in the file, include them in <span> brackets,
and use a class that uses:

Code
font-variant:small-caps;
This isn’t very good, and I wouldn’t get that effect on other ebook
readers. Is there any solution available? The CSS code—

Code
body { font-kerning: normal; font-variant: common-ligatures oldstyle-nums; font-feature-settings: "kern", "liga", "clig", "onum";
}
—seems to be working for EPUB3 (in Calibre), but not when converted to Kindle KFX.

Thanks for your help!
Reply 

#2  Notjohn 03-06-2020, 07:42 PM
What's a "figure"? Indeed, what's an old-style number? Is this a numerical equivalent of the double-S in German or the thorn in Icelandic or the S with a tail in Polish? I can't picture a number of that sort. Well, there's roman numerals, but that's too easy.
Reply 

#3  hobnail 03-06-2020, 09:08 PM
Oops, sorry; I didn't read your last part. On the kindle are you using a font that has oldstyle-nums? Not all do.
Reply 

#4  dwig 03-06-2020, 10:12 PM
Quote Notjohn
What's a "figure"? Indeed, what's an old-style number? Is this a numerical equivalent of the double-S in German or the thorn in Icelandic or the S with a tail in Polish? I can't picture a number of that sort. Well, there's roman numerals, but that's too easy.
"Old-style numbers" = "non-lining numbers" = "lower case numbers". There are several names and they sometimes use "figures" or "numerals" instead of "numbers".

When doing serious type setting for print, I prefer to use them for any numbers that appear in the run of the text, while still using the more common style of number when they appears as leading numbers for a list or in a string of text otherwise in all capitals.

The only good way to use old-style numerals is to use a font containing them. The glyphs are shaped differently from the usual shapes. Their height is more similar to that of the lower case letters and some of the numbers have descenders extending below the baseline. Only a few fonts look halfway decent with faked old-style numerals created by reducing the size of conventional numerals and none really look good. Just as with fake small caps, such fake characters will be lighter in appearance when compared to normal text.
Reply 

#5  Tex2002ans 03-07-2020, 02:42 AM
Quote Enterio
Is there any easy way to edit the CSS to force the Kindle to show figures as old-style figures?
Not really.

You can add the CSS there, and just hope future devices can render Oldstyle Figures (it won't hurt... any device that doesn't understand the CSS will just ignore it).

Here's the Oldstyle Figures code:

Code
font-variant-numeric: oldstyle-nums; /* high-level property */
-moz-font-feature-settings: "onum"; /* low-level (old Firefox) */
-webkit-font-feature-settings: "onum"; /* low-level (old Webkit) */
font-feature-settings: "onum" on; /* low-level (all new browsers) */
that I grabbed from Adobe's fantastic article: "Syntax for OpenType features in CSS".

Side Note: More of this was discussed in technical detail in my 2019 post in "Turn off ligatures (temporarily)". Also see the references to Microsoft's + Mozilla's OpenType documentation.

(Also, check out the rest of that thread... there's a ton of great information in there.)

Quote Enterio
This isn’t very good, and I wouldn’t get that effect on other ebook readers. Is there any solution available? The CSS code—
This code is more advanced CSS3, so many older devices won't support this. Also, it has to have OpenType fonts which have such alternates available.

Quote Notjohn
What's a "figure"? Indeed, what's an old-style number? [...] I can't picture a number of that sort.
Take a look at the post above, where I link to multiple articles with graphics showing what these advanced settings enable.

Here's Mozilla's "OpenType Font Features Guide" for example. They also have brief descriptions of what each setting is used for.
Reply 

#6  RbnJrg 03-07-2020, 07:11 AM
Quote Tex2002ans

that I grabbed from Adobe's fantastic article: "Syntax for OpenType features in CSS".
Indeed, the article is fantastic, and ADE supports quite well those properties (only in epub3).
Reply 

#7  Enterio 03-07-2020, 09:26 AM
The thing is, Kindle can show old-style figures (by drawing glyphs from the .smcp section of the font, when forced with font-variant:small-caps). If the font supports it—such as the one included with the epub by the publisher—it seems very unusual to add support to some OpenType features in the Kindle, and not others.

As a side note, I’m not sure which OpenType features recent Kindles currently support, besides small caps. Stylistic sets? Extended ligatures? Diagonal fractions?

The list in the Adobe article is wonderful, but it doesn’t specify cross-platform compatibility. Some websites (such as this one) mention the small-caps feature as an exclusive EPUB3 feature, and not on Kindles, which is wrong.

It’s not very clear, and their Kindle Previewer software doesn’t offer the slightest hint regarding this. Is there any clear compatibility article somewhere that I missed?
Reply 

#8  hobnail 03-07-2020, 03:18 PM
If the OpenType features the Kindles support isn't listed anywhere then you could test them; here's an epub for testing stuff; dunno if things get lost when converting:

https://www.mobileread.com/forums/sh...feature+peeker
Reply 

#9  Notjohn 03-08-2020, 12:26 PM
I'm still having a problem wrapping my head around this concept. My favorite typeface is Georgia, but its numerals are a bit small, and when I use them in a heading I sometimes add a couple of points to size of the type. Are Georgia's numerals "old style"?
Reply 

#10  JSWolf 03-08-2020, 01:44 PM
Just remember, these tricks will not work in Mobi (in case you're selling eBooks on Amazon).
Reply 

  Next »  Last »  (1/3)
Today's Posts | Search this Thread | Login | Register