Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 07-09-2009, 08:51 AM   #16
dpierron
calibre2opds guru
dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.
 
dpierron's Avatar
 
Posts: 533
Karma: 8792
Join Date: Aug 2005
Location: Metz, France
Device: iPhone, iPad, PRS-650
No problem Paul, it's a pleasure helping you !

Assuming you are trying to go along the way of embedding the fonts, you would put all the three fonts in the content/resources folder. Then, you'd edit the CSS file to add references to your fonts as in :

Code:
@font-face {font-family: "LiberationSans";font-weight: normal;font-style: normal;src: url(LiberationSans-Regular.ttf);}
@font-face {font-family: "FontinSans";font-weight: normal;font-style: normal;src: url(Fontin_Sans_R_45b.otf);}
@font-face {font-family: "Droid";font-weight: normal;font-style: normal;src: url(DroidSerif-Regular.ttf);}
And finally, you would specify (in the CSS again) that the font for h1, h2 and p is one of those referenced above ; for example :

Code:
h1 {
    font-family: "Droid", serif;
   }
h2 {
    font-family: "FontinSans", sansserif;
   }
p {
    font-family: "LiberationSans", sansserif;
   }
Does this help ?
David.
dpierron is offline   Reply With Quote
Old 07-09-2009, 10:53 AM   #17
dpierron
calibre2opds guru
dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.
 
dpierron's Avatar
 
Posts: 533
Karma: 8792
Join Date: Aug 2005
Location: Metz, France
Device: iPhone, iPad, PRS-650
Paul said in a private message to me :

Quote:
I downloaded your font test but I am confused. I think embedding is the simplest way but I don't quite understand it. In your embedded folder you have just the epub file. unpacking it i find that in the content/resources folder you have the usual 0,1, and 2 css files. I assume that in converting to the epub you had a custom css file that assigned the fonts to the tags. How did you get the TTF files to be included in the .epub? Did you do this manually by first renaming the .epub to .zip and then added the TTF files, then renamed it back to epub?
Any more help you can give me would be greatly appreciated! Please walk me through step by step!
You're right, the multiple CSS files were generated by Calibre, when the original ePub file was generated (not by me, but by the book's author himself).

And yes, the TTF files were manually inserted into the ePub file.
Take care, though, because the ePub specification is very sensitive about the zipping of the content (as said here : "This container is generally a zip file but the extension has been renamed to .epub. It has special requirements by including an uncompressed mime type file while the rest of the data in the file is compressed").
I usually use a program named Total Commander (here) which is capable of going into a ZIP file without extracting it, and add/delete/edit files inside... It's a shareware though, but I'm pretty sure there are other means to generate a valid ePub file from its expanded contents.

So, what I do (step by step) is :
  1. open the ePub file in a tab inside Total Commander (control-Pagedown on the file itself opens its contents)
  2. navigate to the resources folder, and copy the TTF files I need
  3. edit one of the CSS files (I pick which one based on what they contain, and what I want to put into) which are not always organised the same way : add the reference to my fonts, and the formatting code (in your case the h1, h2 and p elements).
  4. navigate out of the ePub file, and let Total Commander work its magic...
  5. copy the ePub file to my PR505
  6. look at the marvelous result

Hope this helps,
David.
dpierron is offline   Reply With Quote
Advert
Old 07-10-2009, 12:04 AM   #18
p3aul
Captain Courageous
p3aul doesn't litterp3aul doesn't litter
 
p3aul's Avatar
 
Posts: 239
Karma: 102
Join Date: Apr 2009
Device: calibre, PRS 505
Yes, I think I have it now. Thanks for the step by step! I'm going to save this thread to my computer so I can refer to it. I get as big a blast out of customizing these old books as I do in reading them on my 505!

Paul
p3aul is offline   Reply With Quote
Old 07-10-2009, 02:18 AM   #19
p3aul
Captain Courageous
p3aul doesn't litterp3aul doesn't litter
 
p3aul's Avatar
 
Posts: 239
Karma: 102
Join Date: Apr 2009
Device: calibre, PRS 505
David, embedding the fonts this way, do I still have to specify a custom css file with --override-css ?
Thanks,
Paul
p3aul is offline   Reply With Quote
Old 07-10-2009, 03:35 AM   #20
dpierron
calibre2opds guru
dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.
 
dpierron's Avatar
 
Posts: 533
Karma: 8792
Join Date: Aug 2005
Location: Metz, France
Device: iPhone, iPad, PRS-650
The --override-css option is there to generate a CSS file that is tailored to your needs.

If you follow the step-by-step explanations in my previous post, this option is not necessary, because you'll be modifying the CSS files manually.

But you can also skip the CSS-editing steps and include all the needed information in the --override-css option. It's your choice, and in the end the result is the same...

Cheers,
David.
dpierron is offline   Reply With Quote
Advert
Old 07-11-2009, 02:41 AM   #21
p3aul
Captain Courageous
p3aul doesn't litterp3aul doesn't litter
 
p3aul's Avatar
 
Posts: 239
Karma: 102
Join Date: Apr 2009
Device: calibre, PRS 505
David, I still can't get this thing to work. I downloaded "Total Commander" and used it to modify the index_calibre_2.css file. I added the somewhat cryptic @font-face line and my h1, addition. I also added the one font I was using Fiolex Girls(flx.ttf) to the file. I only changed the title font for this test.

I have uploaded the epub file to my website. Will you please check it out?
www.handleys.us/pride.epub

Thanks,
Paul
p3aul is offline   Reply With Quote
Old 07-11-2009, 03:37 AM   #22
dpierron
calibre2opds guru
dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.
 
dpierron's Avatar
 
Posts: 533
Karma: 8792
Join Date: Aug 2005
Location: Metz, France
Device: iPhone, iPad, PRS-650
Hi Paul,

I checked your file, and somehow you didn't use the font you included anywhere in the CSS files ; you should include a font-family command in one of the elements defined in the CSS.

From what I understood of your aim, it should be in h1 :
Code:
h1 {
    font-family: "Fiolex Girls", serif;
   }
If you look at the CSS files, you'll see that the only style definition on h1 is :
Code:
h1  {font-size: 18pt}
Hope this helps,
David.
dpierron is offline   Reply With Quote
Old 07-11-2009, 08:07 AM   #23
p3aul
Captain Courageous
p3aul doesn't litterp3aul doesn't litter
 
p3aul's Avatar
 
Posts: 239
Karma: 102
Join Date: Apr 2009
Device: calibre, PRS 505
Duh? Yep! I think I should specify the font huh?
Thanks David. That did the trick. I appreciate you helping me. I love the control that Calibre gives me.
Paul
p3aul is offline   Reply With Quote
Old 07-11-2009, 06:02 PM   #24
dpierron
calibre2opds guru
dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.
 
dpierron's Avatar
 
Posts: 533
Karma: 8792
Join Date: Aug 2005
Location: Metz, France
Device: iPhone, iPad, PRS-650
You're welcome Paul, I'm happy to help and glad it eventually worked out !
dpierron is offline   Reply With Quote
Old 07-12-2009, 12:36 AM   #25
p3aul
Captain Courageous
p3aul doesn't litterp3aul doesn't litter
 
p3aul's Avatar
 
Posts: 239
Karma: 102
Join Date: Apr 2009
Device: calibre, PRS 505
Say David, is there anything that will open and allow edit of LRF file?
Paul
p3aul is offline   Reply With Quote
Old 07-12-2009, 12:56 AM   #26
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: 79,796
Karma: 146391129
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
You can use lrf2lrs to convert the LRF into LRS and then use a text editor to edit the LRS and then lrs2lrf to convert back. These are Calibre programs.
JSWolf is offline   Reply With Quote
Old 07-12-2009, 01:40 AM   #27
p3aul
Captain Courageous
p3aul doesn't litterp3aul doesn't litter
 
p3aul's Avatar
 
Posts: 239
Karma: 102
Join Date: Apr 2009
Device: calibre, PRS 505
Thanks, wolf. Yeah I did some searching after I posted and found a website that told me that. New Problem:

I open the resulting lrs file in "xml marker". There is no clear-cut tag that would say(for example) <h1> {font-family..etc I see "Blockstyle and a code, like 388 and "Textstyle and 389. I see nothing that indicates what might be a font for the title anywhere. First I took an epub file that I had modified with David's help and converted it to LRF, then I used this as input to lrf2lrs. I then opened the lrs file in "Xml marker". I know the font I had put in there and that the modification worked, but I can't locate a reference to it in the LRS file.

Also, only the table of contents got converted, Heaven only knows where the rest of it went!
Thanks,
Paul
p3aul is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining font styles into single ttf file sherman Sony Reader Dev Corner 4 04-24-2009 09:21 PM
feed to lrf, how do I change font (or have default font) lovemov Calibre 3 03-16-2009 10:57 PM
Changing default font in Mobipocket? smp_iliad iRex 1 02-12-2009 09:46 PM
iLiad Changing the default sound ericshliao iRex Developer's Corner 4 12-21-2008 12:05 PM
Font changing sizes... rixte Bookeen 5 12-19-2007 05:58 PM


All times are GMT -4. The time now is 04:28 AM.


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