hocr: fix unbound local

This commit is contained in:
James R. Barlow
2024-01-07 01:33:36 -08:00
parent 9fbbcf7599
commit 602f5632cb
+1 -2
View File
@@ -221,6 +221,7 @@ class HocrTransform:
if not found_lines:
# Tesseract did not report any lines (just words)
root = self.hocr.find(self._child_xpath('div', 'ocr_page'))
direction = self._get_text_direction(root)
self._do_line(
canvas,
root,
@@ -376,8 +377,6 @@ class HocrTransform:
text.text_transform(Matrix(-1, 0, 0, -1, box.llx + box.width, 0))
text.horiz_scale(100 * box.width / font_width)
text.show(self._font.text_encode(elemtxt))
# elif text_direction == TextDirection.RTL:
# text.show(self._font.text_encode(elemtxt[::-1]))
# Get coordinates of the next word (if there is one)
hocr_next_box = (