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

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 06-06-2011, 10:40 PM   #1
anamardoll
Chasing Butterflies
anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.
 
anamardoll's Avatar
 
Posts: 3,132
Karma: 5074169
Join Date: Mar 2011
Location: American Southwest
Device: Uses batteries.
Red face Removing Font and Margin Overrides

Complete newbie to the epub forum here. Hi.

(Please don't kill me with sheep. )

I'm really liking my new Sony reader, but I'm astounded to see that there's a high variation in embedded fonts and margin sizes in my epub collection.

I'm kind of a control freak, so I'd like to strip out the embedded fonts on all my books and force them to conform to my device-font. And while I'm at it, I wouldn't mind ripping out the predefined margins, because some of my books have a wasted inch of space or more. Ick.

I know just enough about epubs to turn the .epub extension into a .zip extension and look at the .css file. That is it. I know what CSS looks like, but have no idea what does what or what I need to change, etc.

So...

1. Is there a program (Sigil? Calibre?) that will let me change my epubs or do I have to modify them through the zip file --> css method?

2. What piece of code is in the epubs to override my device fonts and what should I change it to so that it will stop overriding my device?

3. Same question, but about margins: how do I modify them?

4. Is there a way (please dear god, let there be a way) to automate this for my 350+ epubs or must I do all this by hand?

Thank you in advance.
anamardoll is offline   Reply With Quote
Advert
Old 06-07-2011, 04:11 AM   #2
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,265
Karma: 113755271
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
Perhaps Calibre can do something with the conversion from epub to epub, I don't know. I don't like the code from Calibre...

The fonts are the most easy to remove. Just load the epub in Sigil and remove the font-face and font-family references. That should take care of that.

Margins are a bit more difficult. Margins can be set on many levels, @page, body, paragraph and so on. Just search on 'margin-' in the CSS and you schould be able to get most. However, take in mind that no margins at all is not always pleasant to read. That depends on the book.
Then of course there can be internal stylesheets in each xhtml file. There also references to the font and margins can be set.

Many ways to do things and I thing that in your collection all methods are used. That makes is more difficult to automate things. Again, perhaps you can use Calibre conversion.
Toxaris is offline   Reply With Quote
Old 06-07-2011, 09:33 AM   #3
anamardoll
Chasing Butterflies
anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.
 
anamardoll's Avatar
 
Posts: 3,132
Karma: 5074169
Join Date: Mar 2011
Location: American Southwest
Device: Uses batteries.
Apparently, there is a Calibre plugin for removing the default fonts, so I was able to get that to work, yay.

I'm still running into weirdness on the new font, though. The old, font-embedded books look different from the new, non-font-embedded books, even when using the same font (Charis). The font on the reader looks super-bold and thick.

The CSS for my reader font is:

Quote:
@font-face {
font-family: "Charis";
font-weight: normal;
font-style: normal;
src: url(res:///Data/fonts/Charis-Regular.ttf);
}

@font-face {
font-family: "Charis";
font-weight: bold;
font-style: normal;
src: url(res:///Data/fonts/Charis-Bold.ttf);
}

@font-face {
font-family: "Charis";
font-weight: normal;
font-style: italic;
src: url(res:///Data/fonts/Charis-Italic.ttf);
}

@font-face {
font-family: "Charis";
font-weight: bold;
font-style: italic;
src: url(res:///Data/fonts/Charis-BoldItalic.ttf);
}

body {
font-family: "Charis", serif;
/* line-height: 150% */
}

.calibre {
font-family: "Charis", serif;
/* line-height: 150% */
}
The CSS from the embedded-font (back when it was embedded) was (snippet):

Quote:
.calibre {
background-color: #FFF;
display: block;
font-family: "Charis";
font-size: 1em;
line-height: 1.2;
margin-bottom: 0;
margin-left: 5pt;
margin-right: 5pt;
margin-top: 0;
padding-left: 0;
padding-right: 0;
text-align: center
}
I'm not sure I know enough about CSS to get the new font to behave like the old ones did. I've tried adding the font-size / line-height lines to my CSS, but nothing changed. I'd like uniformity across my books.
anamardoll is offline   Reply With Quote
Old 06-08-2011, 02:09 PM   #4
shall1028
Groupie
shall1028 can bend spoons with a thought.shall1028 can bend spoons with a thought.shall1028 can bend spoons with a thought.shall1028 can bend spoons with a thought.shall1028 can bend spoons with a thought.shall1028 can bend spoons with a thought.shall1028 can bend spoons with a thought.shall1028 can bend spoons with a thought.shall1028 can bend spoons with a thought.shall1028 can bend spoons with a thought.shall1028 can bend spoons with a thought.
 
Posts: 158
Karma: 134084
Join Date: Jun 2010
Device: Kobo
Smile

Quote:
Originally Posted by anamardoll View Post
I'm kind of a control freak, so I'd like to strip out the embedded fonts on all my books and force them to conform to my device-font. And while I'm at it, I wouldn't mind ripping out the predefined margins, because some of my books have a wasted inch of space or more. Ick.
I suppose that old-fashioned "processed dead tree carcass" books must just send you into apoplectic fits. A good sharp knife or guillotine cutter can help trim away the excess paper to solve the margin problem. You could copy out the contents of every book to a blank notebook in your own handwriting to solve the font problem.
shall1028 is offline   Reply With Quote
Old 06-08-2011, 02:27 PM   #5
anamardoll
Chasing Butterflies
anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.
 
anamardoll's Avatar
 
Posts: 3,132
Karma: 5074169
Join Date: Mar 2011
Location: American Southwest
Device: Uses batteries.
Quote:
Originally Posted by shall1028 View Post
I suppose that old-fashioned "processed dead tree carcass" books must just send you into apoplectic fits. A good sharp knife or guillotine cutter can help trim away the excess paper to solve the margin problem. You could copy out the contents of every book to a blank notebook in your own handwriting to solve the font problem.
Actually, I have stopped reading books for having un-readable fonts. It's rare, but it does happen.

I don't feel the flaws of the old system should carry over to the new system. We have the technology for user-defined fonts, so there's no reason not to employ it wherever possible.
anamardoll is offline   Reply With Quote
Advert
Old 06-08-2011, 03:09 PM   #6
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,265
Karma: 113755271
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
Sometimes a writer has a specific meaning for using a font. Actually, in my library almost no book has build in fonts from the start.
Toxaris is offline   Reply With Quote
Old 06-08-2011, 03:29 PM   #7
anamardoll
Chasing Butterflies
anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.
 
anamardoll's Avatar
 
Posts: 3,132
Karma: 5074169
Join Date: Mar 2011
Location: American Southwest
Device: Uses batteries.
Quote:
Originally Posted by Toxaris View Post
Sometimes a writer has a specific meaning for using a font. Actually, in my library almost no book has build in fonts from the start.
I've had several library books come with embedded fonts -- they are almost always Charis, so I imagine the culprit is the publisher trying to standardize rather than the author wanting a certain effect.

I'm not immune to the argument that the author should have a say in how their product is presented, but font-choice is so personal. If you look at our Sans Serif / Serif poll, you'll see that some people find one or the other to be ABSOLUTELY EYES-BLEEDING UNREADABLE. Furthermore, there is some evidence that different disabilities (like dyslexia) may respond differently to certain fonts.

Given all that, I think it's perfectly acceptable that the author, well, not get to mandate what font their work is read in. They're welcome to make a suggestion, but personal need trumps authorial rights in this case, I think.
anamardoll is offline   Reply With Quote
Old 06-09-2011, 03:33 AM   #8
thydere
Member
thydere began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Nov 2007
Location: Germany
Device: Sony PRS-300
Another solution that might help is to look at rules containing 'font-weight' entries in the produced css - not in the @font-face rules but in general. If some are set to bold/bolder then that might explain the problems you're describing - if so either delete them or set their values to 'normal'.

It's also possible that your html contains inconvenient presentation markup (b, em, h...), although I doubt that since - in my experience - Calibre handles everything with css.

If you completely remove the css stylesheet and still have boldness problems then thats a good indicator that either the markup or - as Toxaris mentioned - inline stylesheets are to blame.

To get rid of the former you could always override the default element rendering by inserting a
Code:
b, em {font-weight: normal; font-style: normal;}
rule into your css - although that would pretty much contradict every usage of those elements, even in cases where their rendering is intended .

For the later have a look at the html files and search for elements which contain style="..." attributes.


Finally there's always the option to convert your book using Stanza Desktop - though I would only recommend that as a fallback option since Stanza rigorously removes all presentational markup (i.e. no italics, bold, etc. anymore).
thydere is offline   Reply With Quote
Old 06-09-2011, 09:13 AM   #9
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 15,087
Karma: 82607120
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
The sad--but honest--news is that there will be no easy automated process that will work for all 350+ of your books. The good news is: once you start rooting around in the CSS and html, it will become easier to spot patterns and methods that people use to put their epubs together. It will get increasingly easier to achieve exactly what you want with practice. But I would never attempt to "fix" 350+ epubs... I only attempt to fix the one I'm reading right now.
DiapDealer is online now   Reply With Quote
Old 06-09-2011, 11:20 AM   #10
anamardoll
Chasing Butterflies
anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.
 
anamardoll's Avatar
 
Posts: 3,132
Karma: 5074169
Join Date: Mar 2011
Location: American Southwest
Device: Uses batteries.
Quote:
Originally Posted by DiapDealer View Post
The sad--but honest--news is that there will be no easy automated process that will work for all 350+ of your books. The good news is: once you start rooting around in the CSS and html, it will become easier to spot patterns and methods that people use to put their epubs together. It will get increasingly easier to achieve exactly what you want with practice. But I would never attempt to "fix" 350+ epubs... I only attempt to fix the one I'm reading right now.
That's a shame.

It really should be possible to automate the process - there's a finite number of ways to set margins, font, and font size in code, so automating a search-and-change process should not be impossible.

Just needs someone who understands the code first.
anamardoll is offline   Reply With Quote
Old 06-09-2011, 12:09 PM   #11
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: 7,009
Karma: 8796505
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by anamardoll View Post
It really should be possible to automate the process - there's a finite number of ways to set margins, font, and font size in code, so automating a search-and-change process should not be impossible.
But some margins are useful, and others are not. For instance, having a margin above and below a poetry fragment or an illustration is good, but the same margin for every paragraph might not be your cup of tea (it's not mine).

And then, what if the code has this:

Code:
.text { margin: 1em 0; }

<p class="text">Some normal text</p>

<div class="text"><img src="image.png" alt=""/></div>

<p class="text">More normal text</p>
and that's even allowing that paragraphs are marked with <p> and other blocks with <div>, which is often not the case...
Jellby is offline   Reply With Quote
Old 06-09-2011, 01:35 PM   #12
anamardoll
Chasing Butterflies
anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.
 
anamardoll's Avatar
 
Posts: 3,132
Karma: 5074169
Join Date: Mar 2011
Location: American Southwest
Device: Uses batteries.
I'm more interested in tweaking the left/right side margins -- several books on my reader look like this tiny little median of text with two large highways of blank space on either side.
anamardoll is offline   Reply With Quote
Old 06-09-2011, 08:16 PM   #13
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 45,934
Karma: 33161788
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 4, iPhone 5
Code:
body {
  display: block;
  font-family: "Charis", serif;
  line-height: 1.1em
  margin-bottom: 0;
  margin-left: 0;
  margin-right: 0;
  margin-top: 0;
  widows: 0;
  orphans: 0
}
There is your body code. For me, I prefer no margins on my 650.
JSWolf is offline   Reply With Quote
Old 06-09-2011, 08:32 PM   #14
anamardoll
Chasing Butterflies
anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.anamardoll ought to be getting tired of karma fortunes by now.
 
anamardoll's Avatar
 
Posts: 3,132
Karma: 5074169
Join Date: Mar 2011
Location: American Southwest
Device: Uses batteries.
Thank you -- I'll try that tonight.
anamardoll 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
@page { margin-bottom: 5.000000pt; margin-top: 5.000000pt; } cybmole Conversion 15 02-12-2011 12:57 PM
Removing embedded font/overwrite some css? silentguy Conversion 4 01-25-2011 01:41 PM
ttc font file can't be put into font folder droople Sigil 2 08-21-2010 11:05 AM
calibre ignore margin-top and margin-bottom bender Calibre 2 12-11-2009 07:58 AM
LRF2LRF (Font and Margin modifyer) =X= LRF 18 07-25-2009 12:20 PM


All times are GMT -4. The time now is 10:36 AM.


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