View Single Post
Old 06-07-2023, 08:08 PM   #15
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,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Quote:
Originally Posted by spartanhooah View Post
I suspect my CSS is not up to snuff. Here's what I have in the style file:
Code:
.pre {
  font-family: monospace;
}
@font-face {
  font-family: monospace;
  font-weight: normal;
  font-style: normal;
  src: url(res:///Data/fonts/cour.ttf);
}
@font-face {
  font-family: monospace;
  font-weight: bold;
  font-style: normal;
  src: url(res:///Data/fonts/courbd.ttf);
}
@font-face {
  font-family: monospace;
  font-weight: normal;
  font-style: italic;
  src: url(res:///Data/fonts/couri.ttf);
}
@font-face {
  font-family: monospace;
  font-weight: bold;
  font-style: italic;
  src: url(res:///Data/fonts/courbi.ttf);
}
What am I missing?
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.

Last edited by jackie_w; 06-07-2023 at 08:10 PM.
jackie_w is offline   Reply With Quote