Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f179cce

Browse files
committed
Add kerning to Type 3 font, ASCII strings in PDFs
1 parent 61979db commit f179cce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/matplotlib/backends/backend_pdf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,14 +2287,14 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
22872287
}
22882288
self.file._annotations[-1][1].append(link_annotation)
22892289

2290-
# If fonttype != 3 or there are no multibyte characters, emit the whole
2291-
# string at once.
2292-
if fonttype != 3 or all(ord(char) <= 255 for char in s):
2290+
# If fonttype != 3 emit the whole string at once without manual
2291+
# kerning.
2292+
if fonttype != 3:
22932293
self.file.output(Op.begin_text,
22942294
self.file.fontName(prop), fontsize, Op.selectfont)
22952295
self._setup_textpos(x, y, angle)
2296-
self.file.output(self.encode_string(s, fonttype), Op.show,
2297-
Op.end_text)
2296+
self.file.output(self.encode_string(s, fonttype),
2297+
Op.show, Op.end_text)
22982298

22992299
# There is no way to access multibyte characters of Type 3 fonts, as
23002300
# they cannot have a CIDMap. Therefore, in this case we break the

0 commit comments

Comments
 (0)