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 06-08-2023, 06:17 AM   #16
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: 73,998
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
delete post

Last edited by JSWolf; 06-08-2023 at 06:26 AM.
JSWolf is offline   Reply With Quote
Old 06-08-2023, 06:35 AM   #17
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: 73,998
Karma: 128903378
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 jackie_w View Post
What you're missing is that those 4 CSS @font-face statements are completely wrong for monospace on a Kobo. I don't know why @JSWolf recommended them to you. They might have helped a user of a Sony eink device circa 2010 but they are of no use to a Kobo device of any vintage.

Assuming that you're using one of the stock Kobo reading apps (i.e. not KOReader) then the following is the way to get a monospace font working on any Kobo firmware >= 4.32.xxxxx:

Epub:
  • You don't need any CSS extra @font-face statements.
  • To be on the safe side rename the 4 sideloaded .ttf files so they have external filenames:
    Courier-Regular.ttf (or Courier.ttf)
    Courier-Italic.ttf
    Courier-Bold.ttf
    Courier-BoldItalic.ttf
  • The *internal* font name of all 4 ttfs must be precisely Courier, i.e. none of these is suitable Courier New or Courier Prime or Dark Courier. If your current sideloaded font isn't internally named Courier then you need to use some kind of font editor (e.g. FontForge) or some other font utility (e.g. ttfedit) to change the internal font name to exactly Courier.

Kepub:
Ever since firmware 4.32.xxxxx, the only option is to embed a monospace font into each book that needs it. If you embed the font then it should work equally well as either epub or kepub.
That code was what I used with ePub on Kobo before 4.32. It does work. But the OP was using it with KePub.
JSWolf is offline   Reply With Quote
Old 06-09-2023, 11:27 AM   #18
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by JSWolf View Post
That code was what I used with ePub on Kobo before 4.32. It does work.
I'm afraid not. Those @font-face statements you posted have never worked on a Kobo. Your url paths all begin res:///Data/fonts/... and include a .ttf filename. That's never been the correct path for the Kobo epub reading app to directly reference a sideloaded font.
jackie_w is offline   Reply With Quote
Old 06-13-2023, 05:12 PM   #19
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: 73,998
Karma: 128903378
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 jackie_w View Post
I'm afraid not. Those @font-face statements you posted have never worked on a Kobo. Your url paths all begin res:///Data/fonts/... and include a .ttf filename. That's never been the correct path for the Kobo epub reading app to directly reference a sideloaded font.
If that's not the correct code, what it is?
JSWolf is offline   Reply With Quote
Old 06-14-2023, 12:33 PM   #20
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by JSWolf View Post
If that's not the correct code, what it is?
My earlier post #15 shows the easiest method for standard epubs because you don't need to add any extra @font-faces to each epub to get CSS styles containing font-family:monospace to display in your sideloaded Courier font. The only disadvantage is that you need to go through the one-time font-renaming process if your favourite sideloaded mono font is not already named Courier (internally and externally).

If you want to avoid font-renaming (internal) then you need to add something like the following CSS to every epub that needs it:
Code:
@font-face {
  font-family: monospace;
  font-weight: normal;
  font-style: normal;
  src: url("res:///fonts/normal/Dark Courier");
}
@font-face {
  font-family: monospace;
  font-weight: bold;
  font-style: normal;
  src: url("res:///fonts/bold/Dark Courier");
}
@font-face {
  font-family: monospace;
  font-weight: normal;
  font-style: italic;
  src: url("res:///fonts/italic/Dark Courier");
}
@font-face {
  font-family: monospace;
  font-weight: bold;
  font-style: italic;
  src: url("res:///fonts/bolditalic/Dark Courier");
}
replacing the bold red bits with the actual internal font name of your sideloaded monospace font.

There's also the monospace patch in librmsdk.so.1.0.0.yaml. However, this is less useful than it used to be because when customising it you can only change the default value of Courier to a different font name of <= 7-chars. If you're going to have to do internal font-renaming anyway then you may as well just use the method in post #15.
jackie_w is offline   Reply With Quote
Old 06-15-2023, 05:20 AM   #21
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: 73,998
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
@jackie_w Thank you for the correct CSS code.
JSWolf is offline   Reply With Quote
Old 07-16-2023, 09:42 AM   #22
spartanhooah
Member
spartanhooah began at the beginning.
 
Posts: 19
Karma: 10
Join Date: May 2020
Device: Kobo Clara HD
I apologize for disappearing. I left my Kobo in a seat-back pocket and only just now got a replacement. I used this guide to attempt to embed the monospace font into the kepub, but it still shows the preformatted text in non-monospaced font.
spartanhooah is offline   Reply With Quote
Old 03-13-2024, 04:36 AM   #23
runofthemillgeek
Junior Member
runofthemillgeek began at the beginning.
 
runofthemillgeek's Avatar
 
Posts: 3
Karma: 10
Join Date: Mar 2024
Location: India
Device: Kobo Libra 2
I was pulling my hair out over this issue and found the advise to add the fonts to my epub helped fix the issue in the resulting kepub file.

I had tried to edit and sideload a "Courier" font and changing the epub stylesheet to only have "monospace" for the related CSS rules but didn't help. Only got things to render after packaging the fonts in the epub file.

I have two queries and I'd appreciate if someone could clarify these:

1. As of today, is there no patch that fixes this for kepub files? My understanding is that the patches only help in the case of epubs and not kepubs, including the Courier related one.
2. Is there any way right now to switch to a different sideloaded monospace font without having to add those fonts to the epub?
runofthemillgeek is offline   Reply With Quote
Old 03-13-2024, 08:48 AM   #24
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,161
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Mysteriously the Kobo by default doesn't include monospace. You have to embed a font. Maybe it works if you add the font to the reader, but that would be tricky to get right.
Quoth is offline   Reply With Quote
Old 03-13-2024, 10:43 AM   #25
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,144
Karma: 224760044
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
Quote:
Originally Posted by runofthemillgeek View Post
My understanding is that the patches only help in the case of epubs and not kepubs, including the Courier related one.
That's not quite true. There are patches for kepubs, patches for epubs and patches for both. And patches for other things not related to reading (like homepage).

As to your issue, yeah, that's a kepub problem. Kepubs don't really like to display different fonts in one book. Me, if there's a book which uses many different fonts and it's important to the story, I'll just use epub.

Last edited by Sirtel; 03-13-2024 at 10:47 AM.
Sirtel is offline   Reply With Quote
Reply

Tags
code, css, preformatted


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code View font choices tetrault Sigil 3 05-28-2019 03:11 PM
Change to interface font doesn't stick eater Calibre 3 02-21-2018 03:46 PM
Can't set preferred font in Sigil Code Editor window GrannyGrump Sigil 2 01-26-2014 11:43 PM
Calling all font and code experts ltr Kobo Reader 7 12-09-2011 08:28 PM
Changing font for code view mode matthewyi Sigil 2 11-05-2009 02:20 PM


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


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