Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions __main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,10 @@ def convertToRTF(self, start, finish):
imgx, imgy = shifted_img.size
#print(imgx, imgy)
shifted_img.save(ibytes, 'PNG')
data += r'{\pict\pngblip' + f'\picw{int(imgx*self.rtf_img_factor)}\pich{int(imgy*self.rtf_img_factor)} ' + ibytes.getvalue().hex() + '}'
data += r'{\pict\pngblip' + rf'\picw{int(imgx*self.rtf_img_factor)}\pich{int(imgy*self.rtf_img_factor)} ' + ibytes.getvalue().hex() + '}'
elif t[0] == 'text':
txt = t[1]
txt = txt.replace('\\', '\\\\').replace('{', '\{').replace('}', '\}').replace('\n', r'{\par }') # escape backslash and curly brace
txt = txt.replace('\\', '\\\\').replace('{', r'\{').replace('}', r'\}').replace('\n', r'{\par }') # escape backslash and curly brace
txt = ''.join([fr"\u{ord(c):04d}?" if ord(c) > 0x7F else c for c in txt]) # if non ASCII, then encode the character for RTF
data += txt

Expand Down