Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 03-05-2020, 03:40 PM   #1
Enterio
Member
Enterio began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Oct 2019
Device: Kindle Paperwhite 7th gen
Forcing old-style figures from a font in Kindle

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!
Enterio is offline   Reply With Quote
Old 03-06-2020, 07:42 PM   #2
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
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.
Notjohn is offline   Reply With Quote
Advert
Old 03-06-2020, 09:08 PM   #3
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
Oops, sorry; I didn't read your last part. On the kindle are you using a font that has oldstyle-nums? Not all do.

Last edited by hobnail; 03-06-2020 at 09:10 PM.
hobnail is offline   Reply With Quote
Old 03-06-2020, 10:12 PM   #4
dwig
Wizard
dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.
 
dwig's Avatar
 
Posts: 1,613
Karma: 6718479
Join Date: Dec 2004
Location: Paradise (Key West, FL)
Device: Current:Surface Go & Kindle 3 - Retired: DellV8p, Clie UX50, ...
Quote:
Originally Posted by Notjohn View Post
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.
dwig is offline   Reply With Quote
Old 03-07-2020, 02:42 AM   #5
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by Enterio View Post
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:
Originally Posted by Enterio View Post
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:
Originally Posted by Notjohn View Post
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.

Last edited by Tex2002ans; 03-07-2020 at 02:47 AM.
Tex2002ans is offline   Reply With Quote
Advert
Old 03-07-2020, 07:11 AM   #6
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,542
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by Tex2002ans View Post

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).
RbnJrg is offline   Reply With Quote
Old 03-07-2020, 09:26 AM   #7
Enterio
Member
Enterio began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Oct 2019
Device: Kindle Paperwhite 7th gen
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?
Enterio is offline   Reply With Quote
Old 03-07-2020, 03:18 PM   #8
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
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
hobnail is offline   Reply With Quote
Old 03-08-2020, 12:26 PM   #9
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
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"?
Notjohn is offline   Reply With Quote
Old 03-08-2020, 01:44 PM   #10
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,972
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Just remember, these tricks will not work in Mobi (in case you're selling eBooks on Amazon).
JSWolf is online now   Reply With Quote
Old 03-08-2020, 02:39 PM   #11
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by Notjohn View Post
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"?
Old style numerals have decenders, so the 9 is like a p.

https://cdncms.fonts.net/images/5231...le_Figures.jpg

First line is old style, second line is not. I think Georgia has both so if you want to use the old style you need the css he's using; "font-variant-numeric: oldstyle-nums;". I use that on the body tag and then for the h1, etc. I switch back to regular. I got this from the Blitz site; what my body tag has is "font-variant: common-ligatures oldstyle-nums proportional-nums;" and for h1, h2, h3, h4 it's "font-variant: common-ligatures lining-nums proportional-nums;" and there's other stuff for both of them (e.g., bold for the h tags).

Last edited by hobnail; 03-08-2020 at 03:12 PM.
hobnail is offline   Reply With Quote
Old 03-08-2020, 04:01 PM   #12
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,972
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by hobnail View Post
Old style numerals have decenders, so the 9 is like a p.

https://cdncms.fonts.net/images/5231...le_Figures.jpg

First line is old style, second line is not. I think Georgia has both so if you want to use the old style you need the css he's using; "font-variant-numeric: oldstyle-nums;". I use that on the body tag and then for the h1, etc. I switch back to regular. I got this from the Blitz site; what my body tag has is "font-variant: common-ligatures oldstyle-nums proportional-nums;" and for h1, h2, h3, h4 it's "font-variant: common-ligatures lining-nums proportional-nums;" and there's other stuff for both of them (e.g., bold for the h tags).
And old style numbers look terrible/awful/wrong/really nasty.
JSWolf is online now   Reply With Quote
Old 03-09-2020, 11:26 AM   #13
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,462
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by JSWolf View Post
And old style numbers look terrible/awful/wrong/really nasty.
Jon:

And that's just your opinion. Some folks like them. They can cause technical issues, of course--line-heights and all that--but in terms of appearance, that's up to the individual, Jon.

Hitch
Hitch is offline   Reply With Quote
Old 03-09-2020, 11:59 AM   #14
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,972
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Hitch View Post
Jon:

And that's just your opinion. Some folks like them. They can cause technical issues, of course--line-heights and all that--but in terms of appearance, that's up to the individual, Jon.

Hitch
Yes, it's up to those with no taste.

But seriously, they look like the new Bookerly (at a smallish size where the letters are not aligned).
JSWolf is online now   Reply With Quote
Old 03-09-2020, 03:43 PM   #15
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by hobnail View Post
Old style numerals have decenders, so the 9 is like a p.

https://cdncms.fonts.net/images/5231...le_Figures.jpg

First line is old style, second line is not.
Thanks for the example image.

Mozilla's CSS pages are usually pretty damn good too, and most of the time they have interactive code where you can enable/disable and see what the differences are:

MDN page for "font-variant-numeric"

Quote:
Originally Posted by JSWolf View Post
And old style numbers look terrible/awful/wrong/really nasty.
Only thing that bothers me is OCRing the oldstyle 1 (usually looks like a Roman Numeral I).

In many cases, it's hard to tell which one was intended, especially when dealing with citations:

Code:
Vol. I
Is that equivalent to "Volume 1"?

Usually I have to go hunting much closer throughout the book to see if they use "Vol. II" (Roman Numerals) or "Vol. 2" (Numbers) or "Vol. 11" (Numbers).
Tex2002ans is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dictionary font size and style ams KOReader 5 11-09-2019 02:54 AM
Losing Font Style in Conversion Jimmbo Conversion 4 06-27-2015 12:10 PM
How to change font size and font style? butterbescotch Sigil 20 09-06-2013 08:22 PM
Forcing a quotation mark style Hoods7070 Sigil 27 05-04-2013 03:41 AM
Font / style questions holdit Kindle Fire 0 12-22-2012 12:11 PM


All times are GMT -4. The time now is 05:49 AM.


MobileRead.com is a privately owned, operated and funded community.