10-22-2017, 11:12 PM | #1 |
Fanatic
Posts: 516
Karma: 32106
Join Date: Feb 2012
Device: Onyx Boox Leaf
|
Serif font in Browser Viewer?
Dear Kovid,
Thank you so much for popup footnote in the Browser Viewer - that is the important point for me as my books always have many notes. Great job. However, I would like to read in serif fonts (as default, when no fonts are embedded). Current version forces me to use sans-serif. And one issue that I have found: in black theme, the footnote text color is not changed, hence, blended into black background. Last edited by DiapDealer; 12-03-2017 at 09:48 AM. |
10-23-2017, 04:58 AM | #2 |
creator of calibre
Posts: 43,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
Advert | |
|
11-03-2017, 03:19 AM | #3 | |
Fanatic
Posts: 516
Karma: 32106
Join Date: Feb 2012
Device: Onyx Boox Leaf
|
Quote:
However, I am still unable to get the books to display in serif font nor embedded fonts with font-family family properly declared in their respective css files. I then even entered the following in the User style sheet (new feature) box. But it still doesn't work. The font is still sans-serif for every single text. body { font-family: serif; } And there is this "reload" issue. When I tap on the "Reload" button, the book is downloaded again for offline reading - which is good - but all the css properties seem to be either broken or ignored. All texts are now the same and left aligned, as though they are raw texts in Notepad. After quitting Chrome and loading it back again, the book is ok (of course the font issue remains). (Edit) Ah, I found out that I don't have to quit Chrome, just hit refresh button of Chrome itself. Last edited by nqk; 11-03-2017 at 03:27 AM. |
|
11-03-2017, 03:37 AM | #4 |
creator of calibre
Posts: 43,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
That rule will work only if the book in question does not specify its own fonts. If you want to override book fonts you need something like
Code:
* { font-family: serif !important; } |
11-03-2017, 03:45 AM | #5 | |
Fanatic
Posts: 516
Karma: 32106
Join Date: Feb 2012
Device: Onyx Boox Leaf
|
Quote:
I've attached a file as an example. |
|
Advert | |
|
11-03-2017, 04:06 AM | #6 |
creator of calibre
Posts: 43,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
That would imply your browser has no serif fonts available, or its serif family has been set to a sans-serif font. The viewer does not do anything to CSS in the book, it leaves it up to the browser to render.
|
11-03-2017, 04:20 AM | #7 |
Fanatic
Posts: 516
Karma: 32106
Join Date: Feb 2012
Device: Onyx Boox Leaf
|
I'm just using Chrome for Android and for Windows with no fancy settings. Hmm.
|
11-03-2017, 07:20 AM | #8 |
creator of calibre
Posts: 43,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Actually, it might be inherintg a default style, this should do the trick:
https://github.com/kovidgoyal/calibr...37b8a8986242a1 |
11-03-2017, 01:11 PM | #9 |
Grand Sorcerer
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
@kovid,
Just a note to say that I tried your Browser Viewer fixes by running calibre from source. Everything is working OK for me in Chrome for Android on a Samsung phone. The attached screenshot is for an epub whose only internal CSS font-family styles are for an embedded font which is used for headings and dropcaps. The font displayed for main body text appears to be Droid Serif. I did not need to set up any User stylesheet to do this (ETA: at least not knowingly). Last edited by jackie_w; 11-03-2017 at 02:07 PM. Reason: ETA |
11-03-2017, 07:34 PM | #10 |
creator of calibre
Posts: 43,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Hmm thinking about it, I realize that I do want books that dont specify any fonts to default to sans-serif. But it should be easily overridable, by either a user stylesheet or styles in the book itself. I guess the best way to do that would be to add an extra stylesheet at the top with
Code:
html { font-family: sans-serif } |
11-03-2017, 07:50 PM | #11 |
creator of calibre
Posts: 43,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
This should achieve that: https://github.com/kovidgoyal/calibr...604b491852285b
|
11-03-2017, 08:05 PM | #12 | ||
Grand Sorcerer
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Quote:
Quote:
|
||
11-03-2017, 08:30 PM | #13 |
Grand Sorcerer
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
OK, if I use Browser Viewer in Chrome in Windows 10 I can right-click to access settings Preferences>User style sheet and add body{font-family:serif}. This seems to work fine.
However, when using Chrome for Android what is the equivalent of the right-click to access settings? It's not immediately obvious to me how I can create a User style sheet. |
11-03-2017, 11:56 PM | #14 |
creator of calibre
Posts: 43,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Tap anywhere in the top quarter of the screen to access the controls.
|
11-04-2017, 06:47 AM | #15 | |
Grand Sorcerer
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Quote:
For my info, should it also be possible, in the server's User style sheet, to define body's font-family such that it points to a font which is not embedded in the epub but which exists in a /font directory present in the Android phone's main memory? |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
What is K3 Sans Serif font? | lkkmaths | Amazon Kindle | 0 | 04-27-2011 07:03 AM |
Serif font for JBL | demingite | Ectaco jetBook | 3 | 12-13-2010 09:41 PM |
how to get a serif font to work in an epub | Ray Tayek | Calibre | 3 | 11-29-2010 05:36 PM |
What is the K3 default sans serif font? | jswinden | Amazon Kindle | 4 | 09-20-2010 11:59 AM |
Do you prefer the Reader's serif or its sans serif font? (poll) | Alexander Turcic | Sony Reader | 9 | 11-25-2006 12:15 PM |