View Single Post
Old 02-19-2014, 11:02 PM   #8
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 icallaci View Post
Would you mind elaborating on the monospace font "fix"? Or just point me to an article or thread that discusses it? I have been wondering how to get Kobo to display text in monospace. Thanks.
There are 2 methods depending on why your book needs monospace. I did document option 2 below somewhere in this forum but I can't, for the life of me, remember which thread it was part of, so here it is again:
  1. If you want to read the whole book in monospace (e.g. Screenplays often expect mono throughout) you just need to sideload a monospace font (preferably all 4 flavours, regular, italic, bold, bolditalic, but not essential) and pick the new mono font from the Kobo font menu. Don't forget to power off/on after adding new fonts.

  2. If there are just selected parts of a book which need to be mono (e.g. author wants to simulate an old typewritten letter, code samples in tech manuals).

    Firstly, make sure you've already sideloaded a monospace font into your Kobo fonts directory.

    Secondly, the internal css in the epub needs to have font-family: monospace in all the relevant places.

    Thirdly, you need to enable this feature in the calibre KOBOTOUCH driver. Then in your custom kobo_extra.css include css statements something along these lines (where Dark Courier is the internal name of my sideloaded mono font. It's important to make the code match the internal font name exactly)
    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")}
    If you've only got a single ttf (i.e. only the regular), you can simplify the extra code in kobo_extra.css to
    Code:
    @font-face {font-family: monospace; src: url("res:///fonts/normal/Dark Courier")}
    Once you've added the mono stuff to your custom kobo_extra.css, all future epubs transferred to the Kobo via calibre will get the extra css inserted into the epub during the Send-to-Device process. The calibre library copy of the epub remains untouched. You don't need to worry about adding this extra mono css to epubs which won't need it as it will just be ignored.

I'm not sure whether option 2 will work for kepubs but it definitely works for standard epubs (at least in fw 3.1.1 and many earlier releases).
jackie_w is offline   Reply With Quote