View Single Post
Old 02-16-2013, 02:36 PM   #2
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
I'd love to see this evolve into a proper EPUB font validator, although that would require a slightly more involved approach to working with the HTML than just checking to see whether all the glyphs in a particular book are present in the font.

An ideal implementation would start with the parsed HTML document and CSS declarations, then apply the CSS to determine which styles apply to which words, then check each glyph to make sure it appears in the font that is actually being used to display it. In other words, look at the font family declaration that is active at that point in the DOM tree and check each font sequentially, skipping any font name that isn't embedded.

In addition to printing errors when a glyph would be missing, it should also keep two totals of missing glyphs per font—one in which it includes every error that could potentially occur and one in which it only includes errors that do not result from falling back from another embedded font—and should present those in a summary report at the end, along with a count of the number of unused glyphs in each font.

Oh, and it could also print errors if you specify a font in your CSS and provide it in the bundle but fail to provide a proper @font-face declaration.

Start here:

https://github.com/rennat/pynliner
dgatwood is offline   Reply With Quote