diff --git a/ocrd_browser/model/page_xml_renderer.py b/ocrd_browser/model/page_xml_renderer.py index ef5cbcf..4db6705 100644 --- a/ocrd_browser/model/page_xml_renderer.py +++ b/ocrd_browser/model/page_xml_renderer.py @@ -331,6 +331,9 @@ def paint(self, draw: ImageDraw.Draw, regions: RegionMap) -> None: angle = radians(180.0 - 30) # 30 degrees c, s = cos(angle), sin(angle) d = self.p1[0] - self.p0[0], self.p1[1] - self.p0[1] + if np.isclose(d[0], 0) and np.isclose(d[1], 0): + # arrow start and end very close to each toerh + return left = d[0] * c - d[1] * s, d[0] * s + d[1] * c right = d[0] * c + d[1] * s, -d[0] * s + d[1] * c lf = self.size / (d[0] ** 2 + d[1] ** 2) ** 0.5 diff --git a/ocrd_browser/view/page.py b/ocrd_browser/view/page.py index 20dd467..5969ea8 100644 --- a/ocrd_browser/view/page.py +++ b/ocrd_browser/view/page.py @@ -519,6 +519,19 @@ def _query_tooltip(self, _image: Gtk.Image, x: int, y: int, _keyboard_mode: bool ]: if hasattr(region.region, attribute) and getattr(region.region, attribute): content += '\n@{}={}'.format(attribute, getattr(region.region, attribute)) + if hasattr(region.region, 'Roles') and getattr(region.region, 'Roles'): + roles = getattr(region.region, 'Roles') + if hasattr(roles, 'TableCellRole') and getattr(roles, 'TableCellRole'): + cellrole = getattr(roles, 'TableCellRole') + for attribute in [ + 'rowIndex', + 'columnIndex', + 'rowSpan', + 'colSpan', + 'header', + ]: + if hasattr(cellrole, attribute): + content += '\n@{}={}'.format(attribute, getattr(cellrole, attribute)) if hasattr(region.region, 'TextStyle') and getattr(region.region, 'TextStyle'): style = getattr(region.region, 'TextStyle') for attribute in [ @@ -543,7 +556,7 @@ def _query_tooltip(self, _image: Gtk.Image, x: int, y: int, _keyboard_mode: bool 'smallCaps', 'letterSpaced', ]: - if getattr(style, attribute): + if hasattr(style, attribute): content += '\n@{}={}'.format(attribute, getattr(style, attribute)) if region.warnings: content += '\n\nWarnings:' + ('\n '.join(region.warnings))