+ html_tree, method="html", pretty_print=True))
+
+ toc.add("Strona redakcyjna", "last.html")
+ manifest.append(etree.fromstring(
+ '<item id="last" href="last.html" media-type="application/xhtml+xml" />'))
+ spine.append(etree.fromstring(
+ '<itemref idref="last" />'))
+ html_tree = xslt(document.edoc, get_resource('epub/xsltLast.xsl'))
+ chars.update(used_chars(html_tree.getroot()))
+ zip.writestr('OPS/last.html', etree.tostring(
+ html_tree, method="html", pretty_print=True))
+
+ if not flags or not 'without-fonts' in flags:
+ # strip fonts
+ tmpdir = mkdtemp('-librarian-epub')
+ cwd = os.getcwd()
+
+ os.chdir(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'font-optimizer'))
+ for fname in 'DejaVuSerif.ttf', 'DejaVuSerif-Bold.ttf', 'DejaVuSerif-Italic.ttf', 'DejaVuSerif-BoldItalic.ttf':
+ optimizer_call = ['perl', 'subset.pl', '--chars', ''.join(chars).encode('utf-8'),
+ get_resource('fonts/' + fname), os.path.join(tmpdir, fname)]
+ if verbose:
+ print "Running font-optimizer"
+ subprocess.check_call(optimizer_call)
+ else:
+ subprocess.check_call(optimizer_call, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ zip.write(os.path.join(tmpdir, fname), os.path.join('OPS', fname))
+ manifest.append(etree.fromstring(
+ '<item id="%s" href="%s" media-type="font/ttf" />' % (fname, fname)))
+ rmtree(tmpdir)
+ os.chdir(cwd)