Syllabus 20100217

From XPUB & Lens-Based wiki

Epub hacking Day2

One last look at ecub projects

  • Presentation of the produced ePubs
  • Feedback from assignments, difficulties encountered while working on the ebook, ...

Practical ePub dissection: font embedding

Font embedding is the technique that gives the opportunity to an ebook designer to provide and use his/her own set of fonts. This feature is not yet totally supported by all readers, but no worries the limited reader will use then its own fonts as fallback. So there is not reasons not to start using this feature!

One ePub will be selected to demonstrate how it is possible to manually tweak the ebook CSS in order to use your own fonts in your ebook. Students are asked to follow the different steps using their own epub and a font of their choice.

For example:

 @font-face {
   font-family: "Linux Libertine";
   font-style: normal;
   font-weight: normal;
   src:url(LinLibertine_Re.ttf);
 }


Mass import of images into an ePub

Following the technical course assignment (feedparser epub), we will be looking into automatically adding images from a folder into an ePub skeleton. To do so we will have to automate three steps:

  • add the files in the container
  • declare their location in the file manifest
  • and finally use them in the main book content.

Reference, proof of concept recipe is here.

Fetching images from 4chan

Now that we can easily mass import images into an ePub, we will generate an epub that will be solely made of the images found in a 4chan discussion thread. The image fetching part involves the use of urllib/urllib2 to fetch the page/images and regular expressions to extract the image locations.

Reference, proof of concept recipe is here.


Further reading

FIXME

Next Assignment

If you're quick you should be able to do it before the end of the day...

Try to combine in one python script:

  • fetching the images from 4chan
  • add them in an epub container while experimenting with the layout and image captions
  • use a customized ePub skeleton that has your fonts embedded for the image captions
  • generate the ePub