![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 769
Karma: 1537886
Join Date: Sep 2013
Device: Kobo Forma
|
font-family in <body> HTML or body{} CSS?
Up until now, I've stripped all font information out of my epubs and read with a specific font on my Kobo. I thought I'd try keeping an epub's specific fonts in the book and have a basic question:
The book I'm working with has the following in each file's <body> tag: Code:
<body ... style="font-family:'new caledonia lt std',georgia,serif;"> Code:
body { /* Basic Styling for BODY Section of a File */ font-family: new caledonia lt std, georgia, serif; height: 100%; margin: 0; orphans: 1; padding: 0; widows: 1; } |
![]() |
![]() |
![]() |
#2 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,641
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Code:
body { /* Basic Styling for BODY Section of a File */ font-family: "new caledonia lt std", georgia, serif; height: 100%; margin: 0; orphans: 1; padding: 0; widows: 1; } Code:
font-family: "new caledonia lt std", georgia, serif; Code:
font-family: "Times New Roman", georgia, serif; |
|
![]() |
![]() |
![]() |
#3 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 769
Karma: 1537886
Join Date: Sep 2013
Device: Kobo Forma
|
Quote:
|
|
![]() |
![]() |
![]() |
#4 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,312
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
The other thing to think about… is allowing the user to pick the font they like to read with. IIRC you are doing this for your own personal use, so putting it in the body tag is fine. In general, however, I would only define a specific font in areas where you REALLY need it: headers, letters, songs, poems, etc. Hopefully, that font would help tell the story.
|
![]() |
![]() |
![]() |
#5 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 769
Karma: 1537886
Join Date: Sep 2013
Device: Kobo Forma
|
Quote:
|
|
![]() |
![]() |
![]() |
#6 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,131
Karma: 144284184
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
A lot of times, the font-family in the CSS is garbage, There are no embedded fonts and all there is is a font-family line specifying fonts that don't exist in the ePub.
|
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,607
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
I started cleaning up a book yesterday and for a few minutes couldn't figure out why the font was so large on all the pages.
CSS was clean as I had replaced it. There was no in-line styling. The <body> tag was clean, no <div> tags. Ends up the styling was in the html tag, which I had not seen before in any other book... PHP Code:
|
![]() |
![]() |
![]() |
#8 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,582
Karma: 14328510
Join Date: Nov 2019
Device: none
|
I've always wondered about this, why they do it. I was guessing that maybe they're copying font specifications that were used in the print version.
|
![]() |
![]() |
![]() |
#9 | |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,582
Karma: 14328510
Join Date: Nov 2019
Device: none
|
Quote:
|
|
![]() |
![]() |
![]() |
#10 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 769
Karma: 1537886
Join Date: Sep 2013
Device: Kobo Forma
|
Quote:
|
|
![]() |
![]() |
![]() |
#11 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,607
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
#12 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 769
Karma: 1537886
Join Date: Sep 2013
Device: Kobo Forma
|
OK. Different font question for a different book (Brandon Sanderson's "Steelheart":
https://www.amazon.com/gp/product/B0...?ie=UTF8&psc=1). Downloaded it fresh from Amazon. Added it to Calibre and had it convert to EPUB3. Edited the epub and there's no fonts in the font section and no encryption.xml. But, in the various stylesheets, there are 3 sets of fonts listed (free font sans, serif and mono (4 versions each)). All of them are listed in the stylesheet with: Code:
src: url(XXXXXXXXXXXXXXXX); Are these those obfuscated fonts I keep reading about? |
![]() |
![]() |
![]() |
#13 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,032
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
|
![]() |
![]() |
![]() |
#14 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,131
Karma: 144284184
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
But overall, it's just wrong. Another thing is wrong is trying to duplicate the font used in the pBook when it's totally wrong for eInk. In most cases, it's some form of Garamond and that's too light for eInk. |
|
![]() |
![]() |
![]() |
#15 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,131
Karma: 144284184
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I rarely convert ePub > ePub. I just go in and fix the code by hand.
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Epub CSS Stylesheet: body, html {...? | enuddleyarbl | ePub | 28 | 09-12-2022 04:09 PM |
Calibre default CSS to <body> | heitormsilva | Conversion | 11 | 11-24-2017 10:46 AM |
In CSS, * or body? | Arios | ePub | 10 | 11-03-2015 10:15 AM |
CSS <body> vs. <p> question | Amalthia | Conversion | 7 | 01-21-2014 01:50 AM |
How to change the font-size in the body tag in css? | naisren | Conversion | 2 | 10-01-2012 05:52 PM |