Skip to content

Commit

Permalink
STY: Tweak comments
Browse files Browse the repository at this point in the history
Also change one "elif" to an "if".
  • Loading branch information
j-t-1 authored Jan 28, 2025
1 parent 52f974a commit 594c590
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions pypdf/_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -1924,15 +1924,15 @@ def process_operation(operator: bytes, operands: List[Any]) -> None:
memo_cm = cm_matrix.copy()
memo_tm = tm_matrix.copy()
return None
elif operator == b"ET":
if operator == b"ET":
output += text
if visitor_text is not None:
visitor_text(text, memo_cm, memo_tm, cmap[3], font_size)
text = ""
memo_cm = cm_matrix.copy()
memo_tm = tm_matrix.copy()
# Table 4.7 "Graphics state operators", page 219
# cm_matrix calculation is a reserved for later
# cm_matrix calculation is reserved for later
elif operator == b"q":
cm_stack.append(
(
Expand Down Expand Up @@ -1993,27 +1993,31 @@ def process_operation(operator: bytes, operands: List[Any]) -> None:
memo_cm = cm_matrix.copy()
memo_tm = tm_matrix.copy()
try:
# charMapTuple: font_type, float(sp_width / 2), encoding,
# map_dict, font-dictionary
charMapTuple = cmaps[operands[0]]
_space_width = charMapTuple[1]
# current cmap: encoding, map_dict, font resource name
# (internal name, not the real font-name),
# font-dictionary. The font-dictionary describes the font.
# char_map_tuple: font_type,
# float(sp_width / 2),
# encoding,
# map_dict,
# font_dict (describes the font)
char_map_tuple = cmaps[operands[0]]
# current cmap: encoding,
# map_dict,
# font resource name (internal name, not the real font-name),
# font_dict
cmap = (
charMapTuple[2],
charMapTuple[3],
char_map_tuple[2],
char_map_tuple[3],
operands[0],
charMapTuple[4],
char_map_tuple[4],
)
_space_width = char_map_tuple[1]
except KeyError: # font not found
_space_width = unknown_char_map[1]
cmap = (
unknown_char_map[2],
unknown_char_map[3],
f"???{operands[0]}",
None,
)
_space_width = unknown_char_map[1]
try:
font_size = float(operands[1])
except Exception:
Expand Down

0 comments on commit 594c590

Please sign in to comment.