diff --git a/pypdf/annotations/_markup_annotations.py b/pypdf/annotations/_markup_annotations.py index 580b8bf58..5d7da5659 100644 --- a/pypdf/annotations/_markup_annotations.py +++ b/pypdf/annotations/_markup_annotations.py @@ -103,12 +103,17 @@ def __init__( self[NameObject("/Subtype")] = NameObject("/FreeText") self[NameObject("/Rect")] = RectangleObject(rect) + # Table 225 of the 1.7 reference ("CSS2 style attributes used in rich text strings") font_str = "font: " - if bold: - font_str = f"{font_str}bold " if italic: font_str = f"{font_str}italic " - font_str = f"{font_str}{font} {font_size}" + else: + font_str = f"{font_str}normal " + if bold: + font_str = f"{font_str}bold " + else: + font_str = f"{font_str}normal " + font_str = f"{font_str}{font_size} {font}" font_str = f"{font_str};text-align:left;color:#{font_color}" default_appearance_string = ""