diff -r d001bc703c29 -r aedc309827c7 eric6/QScintilla/Exporters/ExporterRTF.py --- a/eric6/QScintilla/Exporters/ExporterRTF.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/Exporters/ExporterRTF.py Wed Sep 25 18:37:35 2019 +0200 @@ -179,8 +179,10 @@ if wysiwyg: fontKey = None for key, value in list(fonts.items()): - if value.lower() == \ - font.family().lower(): + if ( + value.lower() == + font.family().lower() + ): fontKey = key break if fontKey is None: @@ -190,18 +192,24 @@ font.family())) fontKey = fontCount fontCount += 1 - lastStyle = self.RTF_SETFONTFACE + \ + lastStyle = ( + self.RTF_SETFONTFACE + "{0:d}".format(fontKey) + ) else: lastStyle = self.RTF_SETFONTFACE + "0" if wysiwyg and QFontInfo(font).pointSize(): - lastStyle += self.RTF_SETFONTSIZE + \ + lastStyle += ( + self.RTF_SETFONTSIZE + "{0:d}".format( QFontInfo(font).pointSize() << 1) + ) else: - lastStyle += self.RTF_SETFONTSIZE + \ + lastStyle += ( + self.RTF_SETFONTSIZE + "{0:d}".format(fontsize) + ) sColour = lex.color(istyle) sColourKey = None @@ -213,8 +221,10 @@ colors[colorCount] = sColour sColourKey = colorCount colorCount += 1 - lastStyle += self.RTF_SETCOLOR + \ + lastStyle += ( + self.RTF_SETCOLOR + "{0:d}".format(sColourKey) + ) sColour = lex.paper(istyle) sColourKey = None @@ -226,8 +236,10 @@ colors[colorCount] = sColour sColourKey = colorCount colorCount += 1 - lastStyle += self.RTF_SETBACKGROUND + \ + lastStyle += ( + self.RTF_SETBACKGROUND + "{0:d}".format(sColourKey) + ) if font.bold(): lastStyle += self.RTF_BOLD_ON @@ -239,22 +251,27 @@ lastStyle += self.RTF_ITALIC_OFF styles[istyle] = lastStyle else: - styles[istyle] = \ - self.RTF_SETFONTFACE + "0" + \ - self.RTF_SETFONTSIZE + \ - "{0:d}".format(fontsize) + \ - self.RTF_SETCOLOR + "0" + \ - self.RTF_SETBACKGROUND + "1" + \ - self.RTF_BOLD_OFF + self.RTF_ITALIC_OFF + styles[istyle] = ( + self.RTF_SETFONTFACE + "0" + + self.RTF_SETFONTSIZE + + "{0:d}".format(fontsize) + + self.RTF_SETCOLOR + "0" + + self.RTF_SETBACKGROUND + "1" + + self.RTF_BOLD_OFF + + self.RTF_ITALIC_OFF + ) istyle += 1 else: - styles[0] = self.RTF_SETFONTFACE + "0" + \ - self.RTF_SETFONTSIZE + \ - "{0:d}".format(fontsize) + \ - self.RTF_SETCOLOR + "0" + \ - self.RTF_SETBACKGROUND + "1" + \ - self.RTF_BOLD_OFF + self.RTF_ITALIC_OFF + styles[0] = ( + self.RTF_SETFONTFACE + "0" + + self.RTF_SETFONTSIZE + + "{0:d}".format(fontsize) + + self.RTF_SETCOLOR + "0" + + self.RTF_SETBACKGROUND + "1" + + self.RTF_BOLD_OFF + + self.RTF_ITALIC_OFF + ) f.write(self.RTF_FONTDEFCLOSE + self.RTF_COLORDEFOPEN) for value in list(colors.values()): @@ -268,11 +285,14 @@ self.RTF_BODYOPEN + self.RTF_SETFONTFACE + "0" + self.RTF_SETFONTSIZE + "{0:d}".format(fontsize) + self.RTF_SETCOLOR + "0 ") - lastStyle = self.RTF_SETFONTFACE + "0" + \ - self.RTF_SETFONTSIZE + "{0:d}".format(fontsize) + \ - self.RTF_SETCOLOR + "0" + \ - self.RTF_SETBACKGROUND + "1" + \ - self.RTF_BOLD_OFF + self.RTF_ITALIC_OFF + lastStyle = ( + self.RTF_SETFONTFACE + "0" + + self.RTF_SETFONTSIZE + "{0:d}".format(fontsize) + + self.RTF_SETCOLOR + "0" + + self.RTF_SETBACKGROUND + "1" + + self.RTF_BOLD_OFF + + self.RTF_ITALIC_OFF + ) lengthDoc = self.editor.length() prevCR = False