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 05-23-2024, 02:50 PM   #1
radius
Lector minore
radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.
 
radius's Avatar
 
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>
radius is offline   Reply With Quote
Old 05-23-2024, 03:36 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: 36,873
Karma: 147879470
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.
Attached Files
File Type: zip Courier.zip (204.9 KB, 45 views)
DNSB is offline   Reply With Quote
Old 05-23-2024, 04:18 PM   #3
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,706
Karma: 87663461
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.
Quoth is offline   Reply With Quote
Old 05-23-2024, 04:41 PM   #4
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: 74,669
Karma: 130140792
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 radius View Post
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>
Monospace does not work out of the box. You can get monospace to work with KePub by embedding a monospace font. But you can do it even easier if you use ePub.

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);
}
Now when you have font-family: monospace; you will have a monospace font displayed.
JSWolf is offline   Reply With Quote
Old 05-23-2024, 08:15 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: 36,873
Karma: 147879470
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by JSWolf View Post
Monospace does not work out of the box. You can get monospace to work with KePub by embedding a monospace font. But you can do it even easier if you use ePub.

Spoiler:
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);
}


Now when you have font-family: monospace; you will have a monospace font displayed.
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.
DNSB is offline   Reply With Quote
Old 05-24-2024, 04:05 AM   #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: 74,669
Karma: 130140792
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
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.
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.
JSWolf is offline   Reply With Quote
Old 05-24-2024, 04:41 AM   #7
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,706
Karma: 87663461
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Quote:
Originally Posted by JSWolf View Post
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.
It depends. It might be less editing to add a CSS @font-face bit than find all the source occurrences and add code tags.
Also some apps/devices might ignore indents & justification with code tags?
Quoth is offline   Reply With Quote
Old 05-24-2024, 09:40 AM   #8
radius
Lector minore
radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.radius ought to be getting tired of karma fortunes by now.
 
radius's Avatar
 
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.
radius is offline   Reply With Quote
Old 05-24-2024, 01:28 PM   #9
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,706
Karma: 87663461
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.
Quoth is offline   Reply With Quote
Old 05-24-2024, 05:08 PM   #10
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: 36,873
Karma: 147879470
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by radius View Post
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.
As mentioned, the name can be anything as long as it is no more than 7 characters. The KoboPatch allows you to change Courier but is limited by only having 7 characters available.

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.
DNSB is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 11:38 AM.


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