![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
|
Where to put userStyle.css?
I noticed in libnickel.so.1.0.0 (firmware 2.4.0) there is a reference to "res:///userStyle.css".
Can this file be used to set default CSS parameters, such as setting widows/orphans to zero? If so, where would I put this file on the Kobo's filesystem for the epub reader to see it? |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,775
Karma: 2694823
Join Date: Dec 2011
Location: The Netherlands
Device: Kobo Touch, Glo, Clara HD
|
Ooooh I hope so!
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
I am not experienced in reading binary files, but I think res:///userStyle.css does not point to a file located on the file system, but rather to a resource in the object file itself.
|
![]() |
![]() |
![]() |
#4 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 42
Karma: 40000
Join Date: Sep 2011
Device: Kobo Touch N905, Mini
|
I wonder if that could be reference to the -holy grail user style sheet-
for the browser? I'd love to be able to tweak the contrast minimum font sizes etc to get that working better. |
![]() |
![]() |
![]() |
#5 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
|
Quote:
A similar reference in libnickel.so.1.0.0 is res:///hyphenDicts/ There is a directory usr/local/Kobo/hyphenDicts/ in the firmware archive KoboRoot.tgz, so perhaps these locations refer to somewhere in the firmware's hidden partition? Edit: tshering by object file do you mean libnickel.so.1.0.0? I hadn't thought of that. Last edited by GeoffR; 03-02-2013 at 08:52 PM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 42
Karma: 40000
Join Date: Sep 2011
Device: Kobo Touch N905, Mini
|
Quote:
If the userStyle.css is meant to modify "browser" display characteristics (not ebook display), in linux browsers place the user css file in different locations depending on the browser. eg: opera ... /usr/share/opera/styles/user/"some-user-name.css" chromium ... /home/your-directory/.config/chromium/Default/User StyleSheets/Custom.css firefox ... /home/your-directory/.mozilla/firefox/myfirefox.default/chrome/userChrome.css and /home/your-directory/.mozilla/firefox/myfirefox.default/chrome/userContent.css Since the kobo browser identifies as useragent: Mozilla/5.0 (Linux; U; Android 2.0; en-us; AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 wherever an "Android/AppleWebKit" browser puts the user css, in the system files, is probably the location. |
|
![]() |
![]() |
![]() |
#7 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
@Geoff: What are you putting in the file? You might need to put "!important" on the styles to make sure they override those elsewhere. |
|
![]() |
![]() |
![]() |
#8 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 42
Karma: 40000
Join Date: Sep 2011
Device: Kobo Touch N905, Mini
|
[QUOTE=davidfor;2442829]Because of where Geoff found the reference and the others nearby in the executable, the UserStyle.css is more likely to be used by the epub or kepub readers.
QUOTE] Thanks for the correction davidfor noted ... Calibre having done the trick for the few css changes I needed - I was getting -excited- thinking this might be a clue to how to get the kobo browser to display better especially for sites not yet designed for mobile devices. Other than adding a host file to block ads the browser remains un-tweakable so far with what little I know [sigh] (My old eyes could use different contrast and bigger fonts on most websites) ![]() |
![]() |
![]() |
![]() |
#9 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
Quote:
Frankly, I have no idea about the res-scheme. If, as in the file-scheme, the double slash belongs to the general syntax, I would think that 'res:///' refers to the root directory. As you said there is also the reference res:///hyphenDicts/. You can also find res:///fonts/. To my understanding, these two directories and the userStyle.css should be at the same level as libexec/, var/, bin/, etc. (I say this, because I am not a linux user, and might be wrong). I can, however, not find hyphenDicts/, fonts/, and userStyle.css at this level. So I wonder whether these directories and this file are created and deleted with every opening or closing of a book, or maybe with starting and killing nickel. Now I remember that I once tried to reference a font in the css with the res-scheme, but I did not get it to work. Maybe I misunderstand how to resolve the path. Just for information, you can find these res-references in libadobe.so too. Last edited by tshering; 03-03-2013 at 11:53 AM. |
|
![]() |
![]() |
![]() |
#10 |
Generally Awesome Person
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,100
Karma: 2191133
Join Date: Jan 2013
Location: /dev/kmem
Device: Kobo Clara HD, Kindle Oasis
|
I have to ask... mostly because I'm out and can't try it myself right away
![]() ![]() |
![]() |
![]() |
![]() |
#11 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
|
I tried putting a userStyle.css containing "div, p {margin-left: 4em !important;}" in /, /.kobo, /.kobo/Kobo, /Digital Editions, /Digital Editions/Manifest but I couldn't find any effect in epubs, kepubs, or the web browser.
I also tried "body {orphans: 0 !important; widows: 0 !important;}" to test epubs without any orphans/widows settings, but that had no effect either. Last edited by GeoffR; 03-03-2013 at 07:42 PM. Reason: correct CSS |
![]() |
![]() |
![]() |
#12 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,249
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
Quote:
To solve my long-standing problem accessing a sideloaded monospace font (only for selected css classes of an epub), this works on KoboGlo fw 2.1.5, if you add it to the epub's css file (not tested with fw 2.4.0 as I haven't decided whether to upgrade yet): 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: normal; font-style: italic; src: url('res:///fonts/italic/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: bold; font-style: italic; src: url('res:///fonts/bolditalic/Dark Courier')} With the above @font-faces any css class defined with font-family: monospace; will be directed to use the sideloaded Dark Courier monospace font rather than the Kobo default i.e. the same as the one you selected in font settings for main body font. Similarly, and for completeness: If you have selected css classes (e.g. headings) containing font-family: sans-serif; then adding this to the css file would result in sideloaded font Trebuchet MS being displayed rather than the Kobo default (Avenir I think): Code:
@font-face {font-family: sans-serif; font-weight: normal; font-style: normal; src: url('res:///fonts/normal/Trebuchet MS')} @font-face {font-family: sans-serif; font-weight: normal; font-style: italic; src: url('res:///fonts/italic/Trebuchet MS')} @font-face {font-family: sans-serif; font-weight: bold; font-style: normal; src: url('res:///fonts/bold/Trebuchet MS')} @font-face {font-family: sans-serif; font-weight: bold; font-style: italic; src: url('res:///fonts/bolditalic/Trebuchet MS')} Code:
@font-face {font-family: "SCfont"; font-weight: normal; font-style: normal; src: url('res:///fonts/normal/Charis SIL SmCp')} @font-face {font-family: "SCfont"; font-weight: normal; font-style: italic; src: url('res:///fonts/italic/Charis SIL SmCp')} @font-face {font-family: "SCfont"; font-weight: bold; font-style: normal; src: url('res:///fonts/bold/Charis SIL SmCp')} @font-face {font-family: "SCfont"; font-weight: bold; font-style: italic; src: url('res:///fonts/bolditalic/Charis SIL SmCp')} Unfortunately, I haven't managed to figure out the 'magic formula' required to reference a sideloaded css file containing widows/orphans statements. I've tried the technique which works on a Sony PRST1 (unhacked), but no joy. |
|
![]() |
![]() |
![]() |
#13 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
Thank you jackie_w,
It might be of interest that in libnickel.so.1.0.0 one can find in addition to Quote:
Quote:
Maybe you can draw inspiration from this too? |
||
![]() |
![]() |
![]() |
#14 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
I give a here a list of the file system of the Touch as I can see it. I only removed the subdirectories of ./mnt/onboard/Digital Editions/Annotations, ./mnt/onboard/Digital Editions/Manifest, and some others that I created myself.
Spoiler:
Last edited by tshering; 04-06-2013 at 05:59 PM. |
![]() |
![]() |
![]() |
#15 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 600
Karma: 641742
Join Date: Mar 2012
Location: DE
Device: Kobo Glo
|
Code:
@font-face {
font-family: -ua-default;
font-style : normal;
font-weight : normal;
src : url("res:///fonts/Adobe Text Pro OsF.otf");
}
@font-face {
font-family: -ua-default;
font-style:italic;
font-weight:normal;
src:url("res:///fonts/Adobe Text Pro OsF-Italic.otf");
}
@font-face {
font-family: -ua-default;
font-style:normal;
font-weight:bold;
src:url("res:///fonts/Adobe Text Pro OsF-Bold.otf");
}
@font-face {
font-family: -ua-default;
font-style:italic;
font-weight:bold;
font-variant:normal;
src:url("res:///fonts/Adobe Text Pro OsF-BoldItalic.otf");
}
res:///fonts/ refers to the fonts directory in the root directory of the device. font-variant is not supported, so a fifth style (small-caps) doesn't work. You can also use serif, sans-serif instead of -ua-default; |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
user accessable userStyle.css please | tselling | PocketBook | 14 | 02-25-2022 05:27 PM |
Override ePub CSS with userStyle.css? | barium | Sony Reader Dev Corner | 11 | 07-16-2011 03:25 PM |
PRS-650 PRS 650 Firmware and userStyle.css | mboyaci | Sony Reader | 29 | 01-21-2011 06:30 AM |
userstyle.css and epub margins | tselling | Sony Reader Dev Corner | 8 | 10-28-2010 01:51 PM |
ADE mit userstyle css | mtravellerh | PocketBook | 0 | 05-21-2010 03:40 PM |