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

Go Back   MobileRead Forums > E-Book Readers > Sony Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 11-06-2010, 09:33 PM   #1
snape
Language Lover
snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.
 
snape's Avatar
 
Posts: 111
Karma: 71544
Join Date: Feb 2009
Device: Current: PRS-350, Kindle PW // Previous: PRS-505, Kindle 1, Kindle 2
Fonts not working in a converted book

I've been using CSS to point to my preferred font on my 505, and I've had no problems through hundreds of books. Today I bought a new book, converted it (just like all the others), and loaded it onto my reader. For reasons I haven't been able to figure out, the font isn't what the reader uses for every other book. Instead, it looks like there's been some lock put on the book's default font, and it's still using that. What gives? I can't find anything that makes the programming in this book different from all the others. Has anyone else run into this?

Thanks!
snape is offline   Reply With Quote
Old 11-06-2010, 10:37 PM   #2
koadic
Member
koadic doesn't litterkoadic doesn't litter
 
Posts: 16
Karma: 172
Join Date: Oct 2010
Device: prs-650
Ok, so you altered the css style sheet in the epub, right? did you check to see if there was anything in the actual files (html, xhtml), sometimes, there are extra style definitions entered that way too. Also, does it happen to have a template.xpgt file in there? If the fonts are specified there (unlikely, but a possibility), that overrides anything in the css file when reading on a device using Digital Editions (such as the Sony readers).

ps. lol @ your sig, I have a blue 505, can I join the Order?

Last edited by koadic; 11-06-2010 at 10:39 PM.
koadic is offline   Reply With Quote
Old 11-06-2010, 11:31 PM   #3
slantybard
my parent's oops...
slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.
 
Posts: 463
Karma: 1477570
Join Date: Feb 2009
Device: Vx->Handera->Clie-> Axim->505->650->KPW/Aura ->iOS/L2
Here is a step-by-step way that eliminates most of the formatting/font issues that your css isn't working on in epubs:

1. In calibre, select the book that is giving you problems
2. Right-click that book, and choose Tweak epub from the contextual menu that appears
3. A folder will open up with a bunch of files
4. Delete any file with ".css" in that folder or the sub-folders
5. Delete any file that ends with ".xpgt" - it is usually called "template.xpgt" but occasionally comes in different names
6. Open the ".opf" file using a text editor and delete any lines that have the ".xpgt" file written in them
7. Go back to calibre and choose the button that says rebuild epub
8. Convert the file again so that your css or the calibre default css is written into the epub.
9. Delete the epub off of your reader and add the new epub to the reader.
slantybard is offline   Reply With Quote
Old 11-07-2010, 12:54 AM   #4
koadic
Member
koadic doesn't litterkoadic doesn't litter
 
Posts: 16
Karma: 172
Join Date: Oct 2010
Device: prs-650
Quote:
Originally Posted by slantybard View Post
4. Delete any file with ".css" in that folder or the sub-folders
5. Delete any file that ends with ".xpgt" - it is usually called "template.xpgt" but occasionally comes in different names
The only problem I see in step 4, is that any special formatting for the book, regardless if you want to keep it or not, is then removed from the file never to be seen again unless you have a backup or another copy of the file you download. Sometimes there are elements that enhance the appearance of the book that it would be nice to keep, so it is cleaner to just modify it instead of removing all of it. But as far as xpgt files go, most of the time those are safe to remove, as they are only used by 'Digital Edition' readers anyway.

I personally don't use calibre to modify epub files, as there is very little in the way of fine control. I would instead suggest installing Sigil, and edit the epub files that way.
koadic is offline   Reply With Quote
Old 11-07-2010, 09:47 AM   #5
slantybard
my parent's oops...
slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.
 
Posts: 463
Karma: 1477570
Join Date: Feb 2009
Device: Vx->Handera->Clie-> Axim->505->650->KPW/Aura ->iOS/L2
Quote:
Originally Posted by koadic View Post
The only problem I see in step 4, is that any special formatting for the book, regardless if you want to keep it or not, is then removed from the file never to be seen again unless you have a backup or another copy of the file you download. Sometimes there are elements that enhance the appearance of the book that it would be nice to keep, so it is cleaner to just modify it instead of removing all of it. But as far as xpgt files go, most of the time those are safe to remove, as they are only used by 'Digital Edition' readers anyway.

I personally don't use calibre to modify epub files, as there is very little in the way of fine control. I would instead suggest installing Sigil, and edit the epub files that way.
You have some good points to consider.

You might loose some of the special elements, but if you have your own css codes, this is usually not noticeable, at least for me since I have my formatting preferences set in my css. You can always try and leave the .css file, but since the OP is having troubles with the fonts not converting for them, the .css file is likely the culprit.

Sigil is definitely a more involved but controllable method for doing it. It also takes longer, and if you don't want to learn another learning curve, it may not be the best method for the OP. The only other problem I have with Sigil is that it is still very buggy imho, crashing while you are trying to work with it as well as being extremely slow software - often leaving you sitting there for upwards of 30 seconds while it is trying to do simple things like split your chapter into 2 new chapters.
slantybard is offline   Reply With Quote
Old 11-07-2010, 05:47 PM   #6
snape
Language Lover
snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.snape knows who John Galt is.
 
snape's Avatar
 
Posts: 111
Karma: 71544
Join Date: Feb 2009
Device: Current: PRS-350, Kindle PW // Previous: PRS-505, Kindle 1, Kindle 2
OK, so here's what I did:

Quote:
1. In calibre, select the book that is giving you problems
2. Right-click that book, and choose Tweak epub from the contextual menu that appears
From here I selected "Explode EPUB"
Quote:
3. A folder will open up with a bunch of files
4. Delete any file with ".css" in that folder or the sub-folders
Done. There was probably some stuff in the original CSS file that I could have left intact, but I figured, what the hell. So the entire file went in the trash. (And I do have a safe backup copy, in case I royally screwed something up.)
Quote:
5. Delete any file that ends with ".xpgt" - it is usually called "template.xpgt" but occasionally comes in different names
6. Open the ".opf" file using a text editor and delete any lines that have the ".xpgt" file written in them
I didn't see any .xpgt files, so I skipped these 2 steps.
Quote:
7. Go back to calibre and choose the button that says rebuild epub
8. Convert the file again so that your css or the calibre default css is written into the epub.
9. Delete the epub off of your reader and add the new epub to the reader.
Done.

Result: The font is fixed! A number of text treatments, such as centering, paragraph indents, and some other things, were removed along with the pre-determined font, but those were mostly relegated to title and chapter heading pages, and so aren't a big deal to me. I can handle page breaks comprised of a blank line instead of an indented first line. I may do a little more tweaking (if I can figure out how), but for now I'm a happy camper.

Many, many thanks to koadic and slantybard!

(@koadic - you're welcome to join the Order; the more BOoBS the better! )
snape is offline   Reply With Quote
Old 11-07-2010, 06:22 PM   #7
slantybard
my parent's oops...
slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.
 
Posts: 463
Karma: 1477570
Join Date: Feb 2009
Device: Vx->Handera->Clie-> Axim->505->650->KPW/Aura ->iOS/L2
Glad to hear it worked out. Yes, there are some tweaks you need for the css, but that depends on each person's desire for formatting. If you search in the Calibre forum under css, you can find several examples of css stuff that people use.

Thanks for pointing out that I forgot to add the explode epub step.
slantybard is offline   Reply With Quote
Old 11-07-2010, 10:15 PM   #8
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 850
Karma: 2641698
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Guys, deleting the css file in an epub is complete overkill if you just want to remove the font.

What you should do is explode the epub using calibre. edit the css file using your favorite text editor (yes, notepad will work, although I wouldn't recommend it) and search for and delete the following...

Any instances of
Code:
@font-face {
some font related styles
}
and
Code:
font-family: font-name(s);
The @font-face rules will generally be grouped together in the CSS, and you can do a simple find/replace using wildcards or regular expressions for the font-family rules.


Then rebuild the epub using calibre and you're done.

Last edited by sherman; 11-07-2010 at 10:18 PM.
sherman is offline   Reply With Quote
Old 11-08-2010, 10:58 AM   #9
jswinden
Nameless Being
 
Quote:
Originally Posted by sherman View Post
Guys, deleting the css file in an epub is complete overkill if you just want to remove the font.

What you should do is explode the epub using calibre. edit the css file using your favorite text editor (yes, notepad will work, although I wouldn't recommend it) and search for and delete the following...

Any instances of
Code:
@font-face {
some font related styles
}
and
Code:
font-family: font-name(s);
The @font-face rules will generally be grouped together in the CSS, and you can do a simple find/replace using wildcards or regular expressions for the font-family rules.


Then rebuild the epub using calibre and you're done.
Yes!

Deleting the whole CSS file is risky. I've seen a LOT of ebooks that were formatted in ridiculously convoluted ways, mostly because whoever created the file converted it from another format like MS Word or some other non-ebook format. I've seen ePubs that had one <P> tag and hundreds or thousands of <br />, <span>, and <div> tags. If you delete the CSS from a book like that you will probably have a difficult to read book.

Last edited by jswinden; 11-08-2010 at 11:01 AM.
  Reply With Quote
Old 11-08-2010, 11:46 PM   #10
slantybard
my parent's oops...
slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.slantybard ought to be getting tired of karma fortunes by now.
 
Posts: 463
Karma: 1477570
Join Date: Feb 2009
Device: Vx->Handera->Clie-> Axim->505->650->KPW/Aura ->iOS/L2
Quote:
Originally Posted by jswinden View Post
Yes!

Deleting the whole CSS file is risky. I've seen a LOT of ebooks that were formatted in ridiculously convoluted ways, mostly because whoever created the file converted it from another format like MS Word or some other non-ebook format. I've seen ePubs that had one <P> tag and hundreds or thousands of <br />, <span>, and <div> tags. If you delete the CSS from a book like that you will probably have a difficult to read book.
It depends on your time and goals. The best thing about calibre is that it is easy to work on duplicates of the original epub so that if you don't like your new book, you can always regress.

Many of the publisher css files are very poorly coded and I have seen some with literally hundreds of font references. Further, not everyone has the skill or time to mess with the css and wants a quick and easy way of dealing with the file. If you have a standard css override in calibre (ie: a few font-face lines and p and div line) then the formatting of the book is just fine if you delete the original css file. Your example of the MS Word file above in my mind is a perfect example to delete the original css file.

In the end, everyone has their own level of perfectionism when it comes to their ebooks. Some don't care if the the PDF they converted has awkward line breaks with page numbers and author name stuck in them and others want every book to have the best, perfected coding that takes care of every little detail. It would be ideal if epub coding was better standardized.
slantybard 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
Classic Linking Built-in Unicode Fonts from ePubs on NookDev not working droople Nook Developer's Corner 4 03-26-2010 07:09 PM
pdf converted to epub file not working on my EZ Pocket Pro Pro luvshihtzu Astak EZReader 2 10-20-2009 07:30 PM
Changing fonts not working? tselling Astak EZReader 11 09-21-2009 03:03 PM
Why are some fonts not working?? daviddem HanLin eBook 4 01-22-2009 09:14 AM
PRS-500 Embedded fonts in LRF WORKING igorsk Sony Reader Dev Corner 21 03-23-2007 05:59 AM


All times are GMT -4. The time now is 07:56 AM.


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