Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 06-13-2014, 02:49 PM   #16
GeoffR
Wizard
GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.
 
GeoffR's Avatar
 
Posts: 1,675
Karma: 3275002
Join Date: Nov 2012
Location: New Zealand
Device: Kobo Glo
Quote:
Originally Posted by Jellby View Post
Would it be possible to completely remove the body margin/padding (or make them 0)? I'd like to have simply:

@page { margin: %1 }

without "!important". Hopefully, that will let me force zero margins in a cover page with @page { margin: 0 !important}. But I'm afraid this CSS will have lower priority than the one in the book...
It is not possible for the book to force zero margins, as the left/right margins set by the user with the slider are added to any @page/body margin in the book. (Cover pages in kepubs have zero margins regardless of slider settings, but that seems to be done as a special case by the kepub reader and cannot be controlled from the book).

This patch can force the epub @page margins to zero, but that doesn't affect the left/right margins set by the slider, which are not set using CSS rules. If you used @page {margin: %1} that would result in double-sized left/right margins, as the @page margin would be added to the slider margin.
GeoffR is offline   Reply With Quote
Old 06-13-2014, 04:03 PM   #17
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 6,315
Karma: 4963983
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Ah, OK. I guess the first time I saw it I assumed there was a "body { margin: %1 }" or similar in the CSS of the first post. Now I see there isn't, so I should have guessed the side margins are not controlled by CSS (at least not by this piece).
Jellby is offline   Reply With Quote
Old 06-15-2014, 03:51 PM   #18
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 6,315
Karma: 4963983
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Do you know where this 'res:///fonts' directory is located? Can it be accessed from outside the reading app? Could possibly an external CSS file be placed there and used with an @import rule?
Jellby is offline   Reply With Quote
Old 06-15-2014, 05:01 PM   #19
GeoffR
Wizard
GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.
 
GeoffR's Avatar
 
Posts: 1,675
Karma: 3275002
Join Date: Nov 2012
Location: New Zealand
Device: Kobo Glo
Quote:
Originally Posted by Jellby View Post
Do you know where this 'res:///fonts' directory is located? Can it be accessed from outside the reading app? Could possibly an external CSS file be placed there and used with an @import rule?
There seem to be seperate stylesheets for epub books, kepub books, and pocket articles. The kepub stylesheet is .kobo/kepub/kepub-book.css, the pocket stylesheet is pocket.css but I don't know where it is located, and the epub stylesheet is res:///userStyle.css, but I don't know where that goes either (or if it even refers to a filesystem location at all).

Resources such as res:///fonts don't necessarily refer to a specific directory. I think res:///fonts refers to anywhere that the reader looks for fonts, including the fonts/ directory on the user partition, the /usr/local/Trolltech/QtEmbedded-4.6.2-arm/lib/fonts/ directory on the system partition, and perhaps other places too.

I have tried adding rules such as @import `mystyle.css`; to the beginning of the built-in epub stylesheet, but either it is ignored or I haven't found the correct place to put mystyle.css.

In short, there may be a way to add a user stylesheet for epubs, but I don't think anyone has found out how to do it yet. (Other than modifying the internal stylesheet, as this patch does).
GeoffR is offline   Reply With Quote
Old 06-15-2014, 06:30 PM   #20
jackie_w
Wizard
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: 2,908
Karma: 4329387
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"/AuraH2O
Quote:
Originally Posted by Jellby View Post
Do you know where this 'res:///fonts' directory is located? Can it be accessed from outside the reading app? Could possibly an external CSS file be placed there and used with an @import rule?
Depending on what you're trying to do, you can directly reference the res:///fonts directory from css @font-faces inside standard epubs (not sure about kepubs).

For instance, Kobos don't have a built-in monospace font and I actively avoid embedding fonts, so I've used this method when I want to reference a sideloaded monospace font for selected css classes only (e.g. code snippets). The same method works when a true small-caps font is desirable.

It may not be relevant for your purposes, but just in case, here's a sample bit of css:
Spoiler:
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")}

FWIW, I also tried very hard to find a way to reference an on-device custom css file using an @import. No joy, I'm afraid. I'm not sure why it doesn't work because it works fine on other 'Adobe-style' readers like the Sony and even the Mantano android reading app.

The nearest I could get to a custom css file stored on the Kobo was this option in the calibre Kobo driver.

ETA: I have been using the Kobo driver method, for many months, to force custom @page margins as GeoffR's new patch wasn't available when I transferred all my books. If/when I next need a factory reset, this patch seems like the better option.

Last edited by jackie_w; 06-15-2014 at 06:42 PM.
jackie_w is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Margin bottom, top problem on tablet zs55 Reading and Management 7 05-23-2013 07:20 AM
ODT to EPUB: margin-top and -bottom in tables beedaddy Conversion 0 05-25-2012 06:05 AM
margin top, bottom, additive or not ? cybmole Conversion 5 02-16-2011 01:33 PM
anyway to change Kindle top/bottom margin? cdpango Kindle Developer's Corner 2 11-28-2010 09:20 PM
calibre ignore margin-top and margin-bottom bender Calibre 2 12-11-2009 07:58 AM


All times are GMT -4. The time now is 04:21 PM.


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