Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 11-24-2021, 08:43 PM   #1
Liudprand
Zealot
Liudprand began at the beginning.
 
Posts: 126
Karma: 10
Join Date: Nov 2021
Device: Kobo Libra 2
How to force old-style figures ("text figures") in conversion to kepub?

Does anyone know whether it's possible, using the KoboTouchExtended plugin (or otherwise), to format all of the numerals so that they appear as properly typset text figures, rather than the more ugly lining figures?

In case anyone wonders: yes, I'm using a font that includes old-style figures.
Liudprand is offline   Reply With Quote
Old 11-24-2021, 08:55 PM   #2
Sirtel
Grand Sorcerer
Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.
 
Sirtel's Avatar
 
Posts: 10,129
Karma: 224760044
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
Is the original epub? Why not just read that, without converting?
Sirtel is offline   Reply With Quote
Advert
Old 11-24-2021, 09:45 PM   #3
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by Liudprand View Post
Does anyone know whether it's possible, using the KoboTouchExtended plugin (or otherwise), to format all of the numerals so that they appear as properly typset text figures, rather than the more ugly lining figures?

In case anyone wonders: yes, I'm using a font that includes old-style figures.
I had to look up what you meant by "old-style figures" and "lining figures". And, honestly, I'm tempted to not help as I don't think the "old-style figures" make the text more readable. The page probably looks better when it appears, but, I don't think that reading long numbers like that is easier.

Having said that, you shouldn't have to do anything. The built-in font Georgia has the old style numbers and they are used when numbers are used in the text. Most of the other built-in fonts use lining figures, and again, that is how numbers appear with these fonts. To user your font, either embed it in the book and select "Publisher Default" as the font. Or add the fonts to the device and select it.

If the font you want to use does something else, then you would need to edit the book to match how it works. I can only think that would be if the font has both styles with one style in the "normal" place, and the other somewhere else. Then you would need to edit the book to change the numbers to use the other characters.
davidfor is offline   Reply With Quote
Old 11-24-2021, 11:12 PM   #4
Liudprand
Zealot
Liudprand began at the beginning.
 
Posts: 126
Karma: 10
Join Date: Nov 2021
Device: Kobo Libra 2
Quote:
Originally Posted by davidfor View Post
I had to look up what you meant by "old-style figures" and "lining figures". And, honestly, I'm tempted to not help as I don't think the "old-style figures" make the text more readable. The page probably looks better when it appears, but, I don't think that reading long numbers like that is easier.
Thanks. I'm sure you're right for most readers. But one of the things I do for a living it typeset books, and it really is one of the things that bugs me most when it comes to reading e-books as opposed to professionally typeset physical books.

Quote:
Originally Posted by davidfor View Post
Having said that, you shouldn't have to do anything. The built-in font Georgia has the old style numbers and they are used when numbers are used in the text. Most of the other built-in fonts use lining figures, and again, that is how numbers appear with these fonts. To user your font, either embed it in the book and select "Publisher Default" as the font. Or add the fonts to the device and select it.
That's interesting about Georgia - useful to know!

Quote:
Originally Posted by davidfor View Post
If the font you want to use does something else, then you would need to edit the book to match how it works. I can only think that would be if the font has both styles with one style in the "normal" place, and the other somewhere else. Then you would need to edit the book to change the numbers to use the other characters.
Yes, the font I'm using (Minion) has full sets of glyphs for both text figures and lining figures. In fact, the kepub files concerned were converted from Word docs which I prepared myself - and they do have text figures throughout, in the Word file. But for some reason the conversion process reverts them back to lining figures. I imagine there must be some way of editing the font itself, so that text figures are the default (as in Georgia) - and I guess I can research how to do that elsewhere. Anyway, many thanks.
Liudprand is offline   Reply With Quote
Old 11-24-2021, 11:13 PM   #5
Liudprand
Zealot
Liudprand began at the beginning.
 
Posts: 126
Karma: 10
Join Date: Nov 2021
Device: Kobo Libra 2
Quote:
Originally Posted by Sirtel View Post
Is the original epub? Why not just read that, without converting?
The figures don't show up properly in epubs either.
Liudprand is offline   Reply With Quote
Advert
Old 11-24-2021, 11:44 PM   #6
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
In my standard stylesheet.css I use when redoing a Project Gutenberg book for the body tag I have
Code:
body {
    border: 0;
    font-feature-settings: "kern", "liga", "clig", "onum", "pnum";
    font-kerning: normal;
    font-style: normal;
    font-variant: common-ligatures oldstyle-nums proportional-nums;
    hyphens: auto;
    margin: 0;
    padding: 0;
    text-rendering: optimizeLegibility;
    width: auto;
}
I don't remember which ones are needed for old style figures but probably the font-variant: oldstyle-nums and the font-feature-settings: onum are what's needed.
hobnail is offline   Reply With Quote
Old 11-25-2021, 12:24 PM   #7
Liudprand
Zealot
Liudprand began at the beginning.
 
Posts: 126
Karma: 10
Join Date: Nov 2021
Device: Kobo Libra 2
Quote:
Originally Posted by hobnail View Post
In my standard stylesheet.css I use when redoing a Project Gutenberg book for the body tag I have
Code:
body {
    border: 0;
    font-feature-settings: "kern", "liga", "clig", "onum", "pnum";
    font-kerning: normal;
    font-style: normal;
    font-variant: common-ligatures oldstyle-nums proportional-nums;
    hyphens: auto;
    margin: 0;
    padding: 0;
    text-rendering: optimizeLegibility;
    width: auto;
}
I don't remember which ones are needed for old style figures but probably the font-variant: oldstyle-nums and the font-feature-settings: onum are what's needed.
Thanks for this. I'm not familiar enough with CCS to know what I'm doing, but I'll look into it...
Liudprand is offline   Reply With Quote
Old 11-25-2021, 08:07 PM   #8
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Any chance of posting a sample Word document to show the problem? That gives those who are interested a chance to try it and see what happens.
davidfor is offline   Reply With Quote
Old 11-26-2021, 10:51 AM   #9
Liudprand
Zealot
Liudprand began at the beginning.
 
Posts: 126
Karma: 10
Join Date: Nov 2021
Device: Kobo Libra 2
Quote:
Originally Posted by davidfor View Post
Any chance of posting a sample Word document to show the problem? That gives those who are interested a chance to try it and see what happens.
Of course. See attached Word file (the first couple of paras of an article from the London Review of Books that's freely available in full on their website - so, no copyright issues).

When I send this to my device using KoboTouchExtended, most of the formatting shows up fine - including, for example, the small caps on the opening line and in "BC" (in a couple of places in the text). But all of the numerals revert to lining figures. (So, in "284 BC", in the final para., "BC" is set correctly, but "284" isn't.) A case like this is what made me notice the issue in the first place.

Just to clarify: I've installed Minion Pro on the device - but the same issue can be seen using one of the fonts that comes with it, e.g. Malabar.
Attached Files
File Type: docx Text figures & small caps - test.docx (21.4 KB, 123 views)

Last edited by Liudprand; 11-26-2021 at 12:17 PM. Reason: To correct a typo.
Liudprand is offline   Reply With Quote
Old 08-22-2022, 10:18 AM   #10
mazdaspeed
Member
mazdaspeed began at the beginning.
 
Posts: 16
Karma: 10
Join Date: May 2018
Device: calibre
Quote:
Originally Posted by Liudprand View Post
Thanks for this. I'm not familiar enough with CCS to know what I'm doing, but I'll look into it...
As hobnail pointed out, using the "font-variant: oldstyle-nums;" is what controls this. I'm working with Minion in Calibre ebook-edit at this moment, and removing "oldstlyle-nums", and placing it back, turns the numeral style back-and-forth like a switch.

This just just solved my issue as I want the lining numbers for legibility, so I'm removing "oldstyle-nums" in the CSS at the individual class level by adding "font-variant: common-ligatures proportional-nums;" and leaving it at the "body" level as "font-variant: common-ligatures oldstle-nums proportional-nums;." I quite honestly forgot I had this declared at the body level.

You can open your book file with Claibre's ebook-edit.exe and edit the CSS directly. It's fairly simple to follow the constructs, and toward the top you will see the "body" section where hobnail's "font-variant:" example can be added. Just beware that each individual class can have its own font-variant and if there is a "font-variant: normal" property at the class level, this will override anything declared at the body level.

Any property declared below a previous declaration takes precedence. The "body" properties are for the entire layout, but if a body property is changed in a following "class", the class property takes precedence. That's not the whole of CSS rules, but it may be enough to fix your problem.
mazdaspeed is offline   Reply With Quote
Old 08-22-2022, 10:29 AM   #11
mazdaspeed
Member
mazdaspeed began at the beginning.
 
Posts: 16
Karma: 10
Join Date: May 2018
Device: calibre
One more thing I meant to tell you. Presently, Kindle doesn't honor the "oldstyle-num" property and Kobo may not either. Calibre and Apple Books presently both do honor "oldstyle-num" and it's difficult to say which eReaders will or will not, and whether one will at some point in time, and then not at another.
mazdaspeed is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Figures overlap text LeeHigbie Introduce Yourself 0 03-12-2020 10:47 PM
Forcing old-style figures from a font in Kindle Enterio Kindle Formats 21 03-11-2020 04:07 AM
I imported a "kepub.ebub" book into Calibre, but Calibre converted to "epub". Why? droopy Calibre 5 12-23-2019 07:33 AM
Where To Put <style type="text/css"> Code SeaCanary Sigil 4 01-28-2014 08:33 PM
Figures that contain text xmlgirl Workshop 9 05-11-2012 11:22 AM


All times are GMT -4. The time now is 12:32 PM.


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