diff --git a/pypdf/_page.py b/pypdf/_page.py index 6e98658fa..c13422392 100644 --- a/pypdf/_page.py +++ b/pypdf/_page.py @@ -1980,21 +1980,12 @@ def process_operation(operator: bytes, operands: List[Any]) -> None: memo_tm = tm_matrix.copy() # Table 5.2 page 398 elif operator == b"Tz": - if operands: - char_scale = float(operands[0]) / 100.0 - else: - char_scale = 1.0 + char_scale = float(operands[0]) / 100.0 if operands else 1.0 elif operator == b"Tw": - if operands: - space_scale = 1.0 + float(operands[0]) - else: - space_scale = 1.0 + space_scale = 1.0 + float(operands[0] if operands else 0.0) elif operator == b"TL": - if operands: - scale_x = math.sqrt(tm_matrix[0]**2 + tm_matrix[2]**2) - TL = float(operands[0]) * font_size * scale_x - else: - TL = 0.0 + scale_x = math.sqrt(tm_matrix[0]**2 + tm_matrix[2]**2) + TL = float(operands[0] if operands else 0.0) * font_size * scale_x elif operator == b"Tf": if text != "": output += text # .translate(cmap)