code: def update(self):
          
          font = self.editor.font()
          for decoration in self._decorations:
              try:
                  decoration.format.setFont(
                          font, QTextCharFormat.FontPropertiesSpecifiedOnly)
              except (TypeError, AttributeError):  # Qt < 5.3
                  decoration.format.setFontFamily(font.family())
                  decoration.format.setFontPointSize(font.pointSize())
          self.editor.setExtraSelections(self._decorations)
docs: Update editor extra selections with added decorations.
  
          NOTE: Update TextDecorations to use editor font, using a different
          font family and point size could cause unwanted behaviors.