Fix get_rotation

This commit is contained in:
Vinayak Mehta
2018-09-09 10:04:54 +05:30
parent 9878de4dfc
commit 9a6ed555c8
+4 -3
View File
@@ -215,8 +215,9 @@ def get_rotation(lttextlh, lttextlv, ltchar):
Returns Returns
------- -------
rotation : string rotation : string
'' if text in table is upright, 'left' if rotated 90 degree '' if text in table is upright, 'anticlockwise' if
anticlockwise and 'right' if rotated 90 degree clockwise. rotated 90 degree anticlockwise and 'clockwise' if
rotated 90 degree clockwise.
""" """
rotation = '' rotation = ''
@@ -225,7 +226,7 @@ def get_rotation(lttextlh, lttextlv, ltchar):
if hlen < vlen: if hlen < vlen:
clockwise = sum(t.matrix[1] < 0 and t.matrix[2] > 0 for t in ltchar) clockwise = sum(t.matrix[1] < 0 and t.matrix[2] > 0 for t in ltchar)
anticlockwise = sum(t.matrix[1] > 0 and t.matrix[2] < 0 for t in ltchar) anticlockwise = sum(t.matrix[1] > 0 and t.matrix[2] < 0 for t in ltchar)
rotation = 'clockwise' if clockwise < anticlockwise else 'anticlockwise' rotation = 'anticlockwise' if clockwise < anticlockwise else 'clockwise'
return rotation return rotation