05-23-2024, 03:50 PM | #1 |
Lector minore
Posts: 655
Karma: 1738720
Join Date: Jan 2008
Device: Aura One, Paperwhite Signature
|
Kobo's fallback fonts
Hi,
I was wondering if anyone knew what fonts a Kobo (Aura One specifically) chooses for its fallback fonts? The reason I ask is I'm assembling some books for my kid and I find that using bare "monospace" as a font-family doesn't seem to work for me. In the sample code below, I see the first paragraph in a serif font, the second in a sans font, and the third paragraph looks like the first one. Code:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <p style="font-family: serif">This paragraph is in serif font.</p> <p style="font-family: sans-serif">This paragraph is in sans-serif font.</p> <p style="font-family: monospace">This paragraph is in monospace font.</p> </body> </html> |
05-23-2024, 04:36 PM | #2 |
Bibliophagist
Posts: 40,487
Karma: 156982136
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Kobo doesn't ship with a monospaced font but if you place a monospaced font in the fonts directory and make sure it is named Courier. There is a KoboPatcher patch to use other fonts but the name is limited to 7 characters. I just found it easier to change the font filenames and edit the font information in FontForge. I used HP's Dark Courier font for this since I liked it's extra weight.
The fonts directory (the name is case sensitive is created in the root of the exposed storage when your Kobo is connected to your computer. Unzip the attached .zip file and copy the 4 .ttf files into the font directory. This works with ePub but have not tested with kepub. |
Advert | |
|
05-23-2024, 05:18 PM | #3 |
the rook, bossing Never.
Posts: 12,342
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
It's also tricky to get monospace to work on mobi, but it does exist on all the old mobi only Kindles.
I used a monospace embedded in the ebook on epub but checked that it was OK without it. Some epub apps don't support embedded fonts. Amazon has over 95% of English Language ebooks. The majority of ebooks are read on phones. Testing is a pain. |
05-23-2024, 05:41 PM | #4 | |
Resident Curmudgeon
Posts: 76,370
Karma: 136466962
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
The first thing to do it find a Courier font. name the font files... Courier-Regular.ttf Courier-Bold.ttf Courier-Italic.ttf Courier-BoldItalic.ttf Put them in the fonts directory. Then in the CSS, use the following code. Code:
@font-face { font-family:monospace; font-weight: normal; font-style: normal; src: url(res:///Data/fonts/Courier-Regular.ttf); } @font-face { font-family:monospace; font-weight: bold; font-style: normal; src: url(res:///Data/fonts/Courier-Bold.ttf); } @font-face { font-family:monospace; font-weight: normal; font-style: italic; src: url(res:///Data/fonts/Courier-Italic.ttf); } @font-face { font-family:monospace; font-weight: bold; font-style: italic; src: url(res:///Data/fonts/Courier-BoldItalic.ttf); } |
|
05-23-2024, 09:15 PM | #5 |
Bibliophagist
Posts: 40,487
Karma: 156982136
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
In my testing, if you have the font named Courier, you do not need to add the font-face declarations in the CSS for an ePub. Just adding <code> around the text that you want to be monospaced is all that is needed.
|
Advert | |
|
05-24-2024, 05:05 AM | #6 |
Resident Curmudgeon
Posts: 76,370
Karma: 136466962
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Interesting. I recall that just having Courier in fonts worked and then it didn't. Now it seems to work. Good to know that I don't need the @font-face bits.
|
05-24-2024, 05:41 AM | #7 | |
the rook, bossing Never.
Posts: 12,342
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Quote:
Also some apps/devices might ignore indents & justification with code tags? |
|
05-24-2024, 10:40 AM | #8 |
Lector minore
Posts: 655
Karma: 1738720
Join Date: Jan 2008
Device: Aura One, Paperwhite Signature
|
Ah thank you all!
I'm shocked that this doesn't work out of the box. I guess Kobo is trying to save on licensing fees and assumes anyone serious will embed the font instead. If "Courier" is the only acceptable name for a monospace font I think I will just go the embedding route as I don't like Courier and I'm not crazy about hacking up a font to give it the "wrong" name. Thanks for the help. |
05-24-2024, 02:28 PM | #9 |
the rook, bossing Never.
Posts: 12,342
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
I don't why they do it. It's not the money. There are loads of decent free monospace fonts.
|
05-24-2024, 06:08 PM | #10 | |
Bibliophagist
Posts: 40,487
Karma: 156982136
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Courier is not my favourite font but among the other monospaced fonts I've tried, Dark Courier, Courier New, Courier Prime, IBM Plex Mono and Source Code Pro are nothing to write home about either. Since I only use them for computer output, it's not a big deal to me. Some of them come in a semi-bold or font weight 500 variant which I prefer. I also prefer the Courier variants due to my preference for serif fonts but for computer output either works well. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Find fallback font? | Uncle Robin | Calibre | 14 | 12-28-2022 03:57 AM |
Using Google Fonts as fallback for Adobe Fonts | ValTim | ePub | 14 | 01-27-2022 03:59 PM |
How do I manually specify the fallback fonts for sans-serif, serif, monospace, etc.? | rtiangha | KOReader | 4 | 12-19-2019 06:54 AM |
Embedded custom fonts and fallback styling | santosha | Kindle Formats | 10 | 08-14-2013 06:17 PM |
Glo Kobo fonts naming conventions and embedded fonts | roger64 | Kobo Reader | 0 | 05-09-2013 07:30 AM |