View Single Post
Old 02-16-2013, 08:49 AM   #1
AlPe
Digital Amanuensis
AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.
 
AlPe's Avatar
 
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
glyphIgo: font minimizer for EPUB ebooks

Hi,

I would like to receive feedback and comments on a funny/crazy/useful idea I am working on in my spare time these days.

For my business needs I developed a small, simple but extremely useful Python 2.7 script to do the following things:

Code:
$ python glyphIgo.py [ARGUMENTS]

Arguments:
 -h, --help          : print this usage message and exit
 -f, --font <font>   : font file, in TTF/OTF/WOFF format
 -g, --glyphs <list> : use this list of glyphs instead of opening a font file
 -e, --ebook <ebook> : ebook in EPUB format
 -p, --plain <ebook> : ebook file, in plain text UTF-8 format
 -m, --minimize      : retain only the glyphs of <font> that appear in <ebook>
 -o, --output <name> : use <name> for the font to be created
 -s, --sort          : sort output by character count instead of character codepoint
 -q, --quiet         : quiet output
 -v, --verbose       : verbose output of Unicode codepoints

Exit codes:

 0 = no error / no missing glyphs in the font file
 1 = invalid argument(s) error
 2 = missing glyphs in the font file to correctly display the given file/ebook
 4 = minimization/conversion failed

Examples:

 1. Print this usage message
    $ python glyphIgo.py -h

 2. Print the list of glyphs in font.ttf
    $ python glyphIgo.py -f font.ttf

 3. Print the list of glyphs in ebook.epub
    $ python glyphIgo.py -e ebook.epub

 4. Print the list of glyphs in page.xhtml
    $ python glyphIgo.py -p page.xhtml

 5. Check whether all the glyphs in ebook.epub are available in font.ttf
    $ python glyphIgo.py -f font.ttf -e ebook.epub

 6. As above, but use font_glyph_list.txt containing a list of decimal codepoints for the font glyphs
    $ python glyphIgo.py -g font_glyph_list.txt -e ebook.epub

 7. As in Example 5, but sort missing glyphs (if any) by character count (in ebook.epub) instead of by Unicode codepoint
    $ python glyphIgo.py -f font.ttf -e ebook.epub -s

 8. Create new.font.otf containing only the glyphs of font.ttf that also appear in ebook.epub
    $ python glyphIgo.py -m -f font.ttf -e ebook.epub -o new.font.otf

 9. Convert font.ttf (TTF) in font.otf (OTF)
    $ python glyphIgo.py -f font.ttf -o font.otf
I am thinking of creating a web site that, using it, exposes its functionality to a user. The idea is to know, before you start reading an eBook that might contain non-Latin glyphs (say, the "Upanishads" or the "Haft Peykar"), if your preferred font can handle all the Unicode chars contained in the eBook.

A "video" of the prototype is here: http://www.albertopettarin.it/glyphIgo/glyphIgo.mov

Currently, I am considering the idea of 1) releasing the Python script; 2) setting up a web site for offering the service for free --- but my sysadmin/PHP skills are minimal and I do not have funds for the server (I need PHP exec and the ability of running my python script => colo server).

I would like to hear your thoughs, especially if they are amazingly crazy or funny

Last edited by AlPe; 02-16-2013 at 08:52 AM. Reason: typo
AlPe is offline   Reply With Quote