-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: invalid cm/tm in visitor functions #2206
Changes from 4 commits
fbc0dc7
5d9226a
4e9cf24
37485df
a05ebc6
4125944
6e01eeb
919d4d6
23d2023
ff71b08
785b5a4
1153081
fb5377f
da0a7eb
8a6a0e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,10 +87,9 @@ def orient(m: List[float]) -> int: | |
|
||
def crlf_space_check( | ||
text: str, | ||
cm_prev: List[float], | ||
tm_prev: List[float], | ||
cm_matrix: List[float], | ||
tm_matrix: List[float], | ||
cmtm_prev: Tuple[List[float], List[float]], | ||
cmtm_matrix: Tuple[List[float], List[float]], | ||
memo_cmtm: Tuple[List[float], List[float]], | ||
cmap: Tuple[ | ||
Union[str, Dict[int, str]], Dict[str, str], str, Optional[DictionaryObject] | ||
], | ||
|
@@ -100,13 +99,21 @@ def crlf_space_check( | |
visitor_text: Optional[Callable[[Any, Any, Any, Any, Any], None]], | ||
spacewidth: float, | ||
) -> Tuple[str, str, List[float], List[float]]: | ||
cm_prev = cmtm_prev[0] | ||
tm_prev = cmtm_prev[1] | ||
cm_matrix = cmtm_matrix[0] | ||
tm_matrix = cmtm_matrix[1] | ||
memo_cm = memo_cmtm[0] | ||
memo_tm = memo_cmtm[1] | ||
|
||
m_prev = mult(tm_prev, cm_prev) | ||
m = mult(tm_matrix, cm_matrix) | ||
orientation = orient(m) | ||
delta_x = m[4] - m_prev[4] | ||
delta_y = m[5] - m_prev[5] | ||
k = math.sqrt(abs(m[0] * m[3]) + abs(m[1] * m[2])) | ||
f = font_size * k | ||
cm_prev = m | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't look quite right. I think this line can however be safely removed, because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agree. |
||
if orientation not in orientations: | ||
raise OrientationNotFoundError | ||
try: | ||
|
@@ -117,8 +124,8 @@ def crlf_space_check( | |
if visitor_text is not None: | ||
visitor_text( | ||
text + "\n", | ||
cm_prev, | ||
tm_prev, | ||
memo_cm, | ||
memo_tm, | ||
cmap[3], | ||
font_size, | ||
) | ||
|
@@ -136,8 +143,8 @@ def crlf_space_check( | |
if visitor_text is not None: | ||
visitor_text( | ||
text + "\n", | ||
cm_prev, | ||
tm_prev, | ||
memo_cm, | ||
memo_tm, | ||
cmap[3], | ||
font_size, | ||
) | ||
|
@@ -155,8 +162,8 @@ def crlf_space_check( | |
if visitor_text is not None: | ||
visitor_text( | ||
text + "\n", | ||
cm_prev, | ||
tm_prev, | ||
memo_cm, | ||
memo_tm, | ||
cmap[3], | ||
font_size, | ||
) | ||
|
@@ -174,8 +181,8 @@ def crlf_space_check( | |
if visitor_text is not None: | ||
visitor_text( | ||
text + "\n", | ||
cm_prev, | ||
tm_prev, | ||
memo_cm, | ||
memo_tm, | ||
cmap[3], | ||
font_size, | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the old comment was more correct, right? This change was probably a side effect of the revert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct we store inhere only tm_matrix