Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 08-27-2024, 05:10 PM   #1
jjalocha
Junior Member
jjalocha began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jun 2023
Device: Kobo Clara 2E
Traditional font styling in Kobo?

I am trying to get my EPUBs to render nicely on the Kobo: custom font, “advanced” font features, like small caps, old-style figures, ligatures.
I have spent countless hours, but I can’t get KOBO to display anything beyond the most basic styling.
I am at the end of my wits and any help would be really appreciated!

Use case:
• My personal EPUB files, prepared manually (from HTML, CSS, OPF, etc.).
• Prepared and used exclusively for my KOBO Clara 2E device, no interest in cross-device compatibility.
• My font of choice (has SC, OSF, etc.)
• I would like to side-load the font, but embedded is also acceptable (if absolutely unavoidable).
• Traditional/advanced font options are imperative (small caps, old-style figures, ligatures, etc.), ideally also variable font features (wght, opsz, wdth).

Setup:
• EPUB validates with epubcheck (no errors, no warnings).
• Kepubify displays no errors, no warnings.
• HTML is displayed correctly in Firefox and Chromium.
• EPUB and KEPUB is displayed correctly in desktop ebook reader.
• ‘Publisher Defaults’ setting.
• Kobo is up to date (4.38.23038).

The only styling recognized:
• Font family (only with embedded font).
• Regular and Italic font.
• Font size.
• Font weight (only when using Fixed font instead of variable font).
• Letter spacing.

Features not working:
• True small caps.
• Old-style figures.
• Standard ligatures.
• Kerning.
• Side-loaded fonts (not even system fonts).
• Hinting seems to be broken for many/most fonts?

I’ve attached a sample EPUB for your reference, and here’s a CSS extract.

Code:
/* Variable font */

@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/SourceSerif4-Regular.ttf") format("truetype");
    font-weight: 200 900;
    font-style: normal;
    font-optical-sizing: none;
}
@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/SourceSerif4-Italic.ttf") format("truetype");
    font-weight: 200 900;
    font-style: italic;
    font-optical-sizing: none;
}

body {
    font-family: "Source Serif 4";
    font-weight: 400;
}

b { font-weight: 700; }
.sc { font-variant: small-caps; }
.osf { font-variant-numeric: oldstyle-nums; }
.lf { font-variant-numeric: lining-nums; }
.lig { font-variant-ligatures: common-ligatures; }
.kern { font-kerning: normal; }
.sys-font { font-family: "Caecilia"; }
.sl-font { font-family: "Bookerly"; }

/* It does display weight when using fixed font */

@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/SourceSerif4-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/SourceSerif4-Italic.ttf") format("truetype");
    font-weight: 400;
    font-style: italic;
}
@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/SourceSerif4-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
}
@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/SourceSerif4-BoldItalic.ttf") format("truetype");
    font-weight: 700;
    font-style: italic;
}
Attached Files
File Type: epub KoboStylingTest.epub (973.4 KB, 35 views)
jjalocha is offline   Reply With Quote
Old 08-27-2024, 07:39 PM   #2
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,647
Karma: 157444382
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
For popup foonotes, you will need to use kepub. The RMSDK renderer used for epub will not do popup footnotes.

You might also want to try adding either text-rendering: optimizeLegibility; or text-rendering: geometricPrecision; to the body class in your stylesheet for kepubs.

Personally, I don't like these since when I tried them years back, they did odd things to the spacing between words especially with justified text.
DNSB is online now   Reply With Quote
Advert
Old 08-27-2024, 08:06 PM   #3
Aleron Ives
Wizard
Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.
 
Posts: 1,442
Karma: 16297052
Join Date: Sep 2022
Device: Kobo Libra 2
You can also edit the Kobo configuration file to test optimizeLegibility and geometricPrecision without having to edit every book. IIRC geometricPrecision generally yields better word spacing than optimizeLegibility, but you get the best word spacing with optimizeSpeed, at the expense of ligatures and kerning.
Aleron Ives is offline   Reply With Quote
Old 08-28-2024, 07:44 AM   #4
jjalocha
Junior Member
jjalocha began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jun 2023
Device: Kobo Clara 2E
Hello David and Aleron,
Thank you so much for helping me with this!
Indeed, text-rendering: geometricPrecision; fixes the rendering of ligatures!
Now, I still need to somehow render old style figures and true small caps (with the corresponding small lining figures).
Variable fonts would also be nice (to achieve truly matching font weights), but I think I can live with the fixed font weights.
Any idea how to achieve any of this?

(I forgot to mention: I am indeed using Kobo EPUB format, not standard EPUB. In my original post, I attached the plain EPUB file sample, because I don’t understand how much/what is altered during the conversion process with kepubify.)

Last edited by jjalocha; 08-28-2024 at 07:49 AM.
jjalocha is offline   Reply With Quote
Old 08-28-2024, 02:53 PM   #5
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,647
Karma: 157444382
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
If you do some searching on MobileRead, you will find some information on features such as small-caps. One I had saved from a few years back was:
Code:
font-variant: small-caps;               /* high-level property          */
font-variant-caps: small-caps;          /* high-level property          */
-moz-font-feature-settings: 'smcp';     /* low-level (old Firefox)      */
-webkit-font-feature-settings: 'smcp';  /* low-level (old Webkit)       */
font-feature-settings: 'smcp' on;       /* low-level (all new browsers) */
which worked on a couple of ePub3 ebooks with an OTF font with small caps.

Edit: I never bothered to break the code down to see which option actually triggered small caps in the ebooks I was playing with.

Last edited by DNSB; 08-28-2024 at 02:57 PM.
DNSB is online now   Reply With Quote
Advert
Old 08-28-2024, 05:01 PM   #6
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: 76,529
Karma: 136565488
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 DNSB View Post
For popup foonotes, you will need to use kepub. The RMSDK renderer used for epub will not do popup footnotes.

You might also want to try adding either text-rendering: optimizeLegibility; or text-rendering: geometricPrecision; to the body class in your stylesheet for kepubs.

Personally, I don't like these since when I tried them years back, they did odd things to the spacing between words especially with justified text.
When the spacing does get messed up, it's not all that much. Overall, I'd take the occasional messed up word spacing to have kerning.
JSWolf is offline   Reply With Quote
Old 08-28-2024, 05:04 PM   #7
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: 76,529
Karma: 136565488
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 DNSB View Post
If you do some searching on MobileRead, you will find some information on features such as small-caps. One I had saved from a few years back was:
Code:
font-variant: small-caps;               /* high-level property          */
font-variant-caps: small-caps;          /* high-level property          */
-moz-font-feature-settings: 'smcp';     /* low-level (old Firefox)      */
-webkit-font-feature-settings: 'smcp';  /* low-level (old Webkit)       */
font-feature-settings: 'smcp' on;       /* low-level (all new browsers) */
which worked on a couple of ePub3 ebooks with an OTF font with small caps.

Edit: I never bothered to break the code down to see which option actually triggered small caps in the ebooks I was playing with.
Code:
font-variant: small-caps;
works in KePub and it's the standard for ePub 3.
JSWolf is offline   Reply With Quote
Old 08-28-2024, 05:46 PM   #8
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: 11,561
Karma: 230505502
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
Quote:
Originally Posted by JSWolf View Post
When the spacing does get messed up, it's not all that much. Overall, I'd take the occasional messed up word spacing to have kerning.
While I would take missing kerning over messed up spacing any time. I care nothing about kerning, ligatures and other such bells and whistles. I do care about word and letter spacing. And I don't use hyphenation, so those bells and whistles mess up the text considerably in my case.

YMMV.
Sirtel is online now   Reply With Quote
Old 08-28-2024, 06:38 PM   #9
jjalocha
Junior Member
jjalocha began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jun 2023
Device: Kobo Clara 2E
Hello DNSB and JSWolf,
Thanks for chiming in about the small caps issue!
Sadly, the extra instructions (on top of font-variant:small-caps;) don’t work for me, it still renders fake small caps, not the true glyphs provided by the font. (Also, still no old style figures.)
Here’s the relevant CSS:

Code:
@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/SourceSerif4-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/SourceSerif4-Italic.ttf") format("truetype");
    font-weight: 400;
    font-style: italic;
}
@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/SourceSerif4-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
}
@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/SourceSerif4-BoldItalic.ttf") format("truetype");
    font-weight: 700;
    font-style: italic;
}

body {
    font-family: "Source Serif 4";
    font-weight: 400;
    text-rendering: geometricPrecision;
}

.sc {
    font-variant: small-caps;               /* high-level property          */
    font-variant-caps: small-caps;          /* high-level property          */
    -moz-font-feature-settings: "smcp";     /* low-level (old Firefox)      */
    -webkit-font-feature-settings: "smcp";  /* low-level (old Webkit)       */
    font-feature-settings: "smcp" on;       /* low-level (all new browsers) */
}
.osf { font-variant-numeric: oldstyle-nums; }
jjalocha is offline   Reply With Quote
Old 09-03-2024, 11:30 AM   #10
jjalocha
Junior Member
jjalocha began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jun 2023
Device: Kobo Clara 2E
Hello all,
For the record, I wanted to mention that I’ve installed KOReader, and am impressed so far.
I don’t think they get every desirable styling feature possible, but the basics are definitely there.
I‘ve attached a screenshot for your reference. (Shout out to the gorgeous Skolar font from Rosetta Type, btw.)
Thank you all for your kind help!
–J
Attached Thumbnails
Click image for larger version

Name:	screenshot.png
Views:	79
Size:	178.3 KB
ID:	210585  
jjalocha is offline   Reply With Quote
Old 09-03-2024, 01:01 PM   #11
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: 76,529
Karma: 136565488
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 jjalocha View Post
Hello DNSB and JSWolf,
Thanks for chiming in about the small caps issue!
Sadly, the extra instructions (on top of font-variant:small-caps;) don’t work for me, it still renders fake small caps, not the true glyphs provided by the font. (Also, still no old style figures.)
Here’s the relevant CSS:

Code:
@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/SourceSerif4-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/SourceSerif4-Italic.ttf") format("truetype");
    font-weight: 400;
    font-style: italic;
}
@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/SourceSerif4-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
}
@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/SourceSerif4-BoldItalic.ttf") format("truetype");
    font-weight: 700;
    font-style: italic;
}

body {
    font-family: "Source Serif 4";
    font-weight: 400;
    text-rendering: geometricPrecision;
}

.sc {
    font-variant: small-caps;               /* high-level property          */
    font-variant-caps: small-caps;          /* high-level property          */
    -moz-font-feature-settings: "smcp";     /* low-level (old Firefox)      */
    -webkit-font-feature-settings: "smcp";  /* low-level (old Webkit)       */
    font-feature-settings: "smcp" on;       /* low-level (all new browsers) */
}
.osf { font-variant-numeric: oldstyle-nums; }
I've cleaned up your CSS and it does work. I wasn't able to test with your font. But if your font is correctly defined and it supports smallcaps, then you will be OK. One thing though to get smallcaps, the text has to be lower case. Uppercase stays as uppercase. So if you are converting from a book using a font size for small caps, you'll also have to use text-transform: lowercase;.

Code:
@font-face {
  font-family: "Source Serif 4";
  src: url(../fonts/SourceSerif4-Regular.ttf);
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: "Source Serif 4";
  src: url(../fonts/SourceSerif4-Italic.ttf);
  font-weight: normal;
  font-style: italic;
}
@font-face {
  font-family: "Source Serif 4";
  src: url(../fonts/SourceSerif4-Bold.ttf);
  font-weight: bold;
  font-style: normal;
}
@font-face {
  font-family: "Source Serif 4";
  src: url(../fonts/SourceSerif4-BoldItalic.ttf);
  font-weight: bold;
  font-style: italic;
}
body {
  font-family: "Source Serif 4";
}
.osf {
  font-variant-numeric: oldstyle-nums;
}
.sc {
  font-variant: small-caps;
}
JSWolf is offline   Reply With Quote
Old 09-05-2024, 04:13 AM   #12
ZodWallop
Gentleman and scholar
ZodWallop ought to be getting tired of karma fortunes by now.ZodWallop ought to be getting tired of karma fortunes by now.ZodWallop ought to be getting tired of karma fortunes by now.ZodWallop ought to be getting tired of karma fortunes by now.ZodWallop ought to be getting tired of karma fortunes by now.ZodWallop ought to be getting tired of karma fortunes by now.ZodWallop ought to be getting tired of karma fortunes by now.ZodWallop ought to be getting tired of karma fortunes by now.ZodWallop ought to be getting tired of karma fortunes by now.ZodWallop ought to be getting tired of karma fortunes by now.ZodWallop ought to be getting tired of karma fortunes by now.
 
ZodWallop's Avatar
 
Posts: 11,360
Karma: 110455811
Join Date: Jun 2015
Location: Space City, Texas
Device: Clara BW; Nook ST w/Glowlight, Paperwhite 3
Quote:
Originally Posted by Sirtel View Post
While I would take missing kerning over messed up spacing any time. I care nothing about kerning, ligatures and other such bells and whistles. I do care about word and letter spacing.
What made me even notice ligatures in the first place was my old Nook STwG which did a very good job on text layout. Except I noticed on a few fonts that words with an 'fi' combination, the dot of the 'i' would overlap with the 'f' and I'd get this odd blob that looked like a 45-degree angled figure 8. Once I noticed it, it became distracting. So ligatures at least are more than just a nicety, for me.
ZodWallop is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Conversion-->Look & feel-->Styling: font-family has no effect ALiSMoNiToS Conversion 2 11-19-2021 12:45 AM
Font Forge and adding font weight for Kobo? Alanon Kobo Reader 7 12-12-2019 05:35 PM
Aura ONE Help with Traditional Chinese on Kobo Aura One DiegoArmando Kobo Reader 0 08-04-2018 05:09 PM
Question about styling Font-Size GrannyGrump Workshop 6 03-17-2017 02:17 AM
Font weight and other styling with RTF for BeBook spaze Other formats 1 09-05-2009 04:25 PM


All times are GMT -4. The time now is 03:10 AM.


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