[Python-apps-commits] r6566 - in packages/ocrodjvu/branches/0.4.6/debian (3 files)
danstender-guest at users.alioth.debian.org
danstender-guest at users.alioth.debian.org
Mon Jan 31 17:59:53 UTC 2011
Date: Monday, January 31, 2011 @ 17:59:47
Author: danstender-guest
Revision: 6566
Fix of upside-down generation of hocr data
[upsidedown-hocr.diff] (closes: #611460).
Added:
packages/ocrodjvu/branches/0.4.6/debian/patches/upsidedown-hocr.diff
Modified:
packages/ocrodjvu/branches/0.4.6/debian/changelog
packages/ocrodjvu/branches/0.4.6/debian/patches/series
Modified: packages/ocrodjvu/branches/0.4.6/debian/changelog
===================================================================
--- packages/ocrodjvu/branches/0.4.6/debian/changelog 2011-01-31 08:41:44 UTC (rev 6565)
+++ packages/ocrodjvu/branches/0.4.6/debian/changelog 2011-01-31 17:59:47 UTC (rev 6566)
@@ -1,3 +1,10 @@
+ocrodjvu (0.4.6-4) unstable; urgency=low
+
+ * Fix of upside-down generation of hocr data
+ [upsidedown-hocr.diff] (closes: #611460).
+
+ -- Daniel Stender <daniel at danielstender.com> Mon, 31 Jan 2011 18:56:48 +0100
+
ocrodjvu (0.4.6-3) unstable; urgency=low
* New maintainer (closes: #598156).
Modified: packages/ocrodjvu/branches/0.4.6/debian/patches/series
===================================================================
--- packages/ocrodjvu/branches/0.4.6/debian/patches/series 2011-01-31 08:41:44 UTC (rev 6565)
+++ packages/ocrodjvu/branches/0.4.6/debian/patches/series 2011-01-31 17:59:47 UTC (rev 6566)
@@ -1,3 +1,4 @@
+upsidedown-hocr.diff
changelog-0.4.6.diff
tests-version.diff
preserve-environment.diff
Added: packages/ocrodjvu/branches/0.4.6/debian/patches/upsidedown-hocr.diff
===================================================================
--- packages/ocrodjvu/branches/0.4.6/debian/patches/upsidedown-hocr.diff (rev 0)
+++ packages/ocrodjvu/branches/0.4.6/debian/patches/upsidedown-hocr.diff 2011-01-31 17:59:47 UTC (rev 6566)
@@ -0,0 +1,47 @@
+--- a/lib/_djvu2hocr.py
++++ b/lib/_djvu2hocr.py
+@@ -64,8 +64,9 @@
+
+ class Zone(object):
+
+- def __init__(self, sexpr):
+- self._sexpr = sexpr
++ def __init__(self, sexpr, page_height):
++ self._sexpr = sexpr
++ self._page_height = page_height
+
+ @property
+ def type(self):
+@@ -73,7 +74,12 @@
+
+ @property
+ def bbox(self):
+- return hocr.BBox(*(self._sexpr[i].value for i in xrange(1, 5)))
++ return hocr.BBox(
++ self._sexpr[1].value,
++ self._page_height - self._sexpr[4].value,
++ self._sexpr[3].value,
++ self._page_height - self._sexpr[2].value,
++ )
+
+ @property
+ def text(self):
+@@ -87,7 +93,7 @@
+ def children(self):
+ for child in self._sexpr[5:]:
+ if isinstance(child, sexpr.ListExpression):
+- yield Zone(child)
++ yield Zone(child, self._page_height)
+ else:
+ yield self.text
+ return
+@@ -313,7 +319,8 @@
+ except sexpr.ExpressionSyntaxError:
+ break
+ print >>sys.stderr, '- Page #%d' % n
+- process_page(Zone(page_text), options)
++ page_zone = Zone(page_text, page_size[1])
++ process_page(page_zone, options)
+ sys.stdout.write(hocr_footer)
+ djvused.wait()
+
More information about the Python-apps-commits
mailing list