![]() |
#1 |
Lector minore
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 652
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> |
![]() |
![]() |
![]() |
#2 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38,717
Karma: 152906060
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 | |
|
![]() |
#3 |
the rook, bossing Never.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,222
Karma: 89531599
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. ![]() |
![]() |
![]() |
![]() |
#4 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 75,605
Karma: 134254544
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); } |
|
![]() |
![]() |
![]() |
#5 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38,717
Karma: 152906060
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 | |
|
![]() |
#6 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 75,605
Karma: 134254544
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.
|
![]() |
![]() |
![]() |
#7 | |
the rook, bossing Never.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,222
Karma: 89531599
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? |
|
![]() |
![]() |
![]() |
#8 |
Lector minore
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 652
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. |
![]() |
![]() |
![]() |
#9 |
the rook, bossing Never.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,222
Karma: 89531599
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.
|
![]() |
![]() |
![]() |
#10 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38,717
Karma: 152906060
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. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Find fallback font? | Uncle Robin | Calibre | 14 | 12-28-2022 02:57 AM |
Using Google Fonts as fallback for Adobe Fonts | ValTim | ePub | 14 | 01-27-2022 02:59 PM |
How do I manually specify the fallback fonts for sans-serif, serif, monospace, etc.? | rtiangha | KOReader | 4 | 12-19-2019 05:54 AM |
Embedded custom fonts and fallback styling | santosha | Kindle Formats | 10 | 08-14-2013 05:17 PM |
Glo Kobo fonts naming conventions and embedded fonts | roger64 | Kobo Reader | 0 | 05-09-2013 06:30 AM |