mirror of
https://github.com/python-pillow/Pillow.git
synced 2026-01-28 02:55:49 +03:00
Encode using latin-1 in PSDraw text() to match the latin-1 specification in setfont() (#9403)
This commit is contained in:
commit
6564325e43
|
|
@ -100,7 +100,8 @@ class PSDraw:
|
|||
Draws text at the given position. You must use
|
||||
:py:meth:`~PIL.PSDraw.PSDraw.setfont` before calling this method.
|
||||
"""
|
||||
text_bytes = bytes(text, "UTF-8")
|
||||
# The font is loaded as ISOLatin1Encoding, so use latin-1 here.
|
||||
text_bytes = bytes(text, "latin-1")
|
||||
text_bytes = b"\\(".join(text_bytes.split(b"("))
|
||||
text_bytes = b"\\)".join(text_bytes.split(b")"))
|
||||
self.fp.write(b"%d %d M (%s) S\n" % (xy + (text_bytes,)))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user