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

Skip to content

Commit 0af3c48

Browse files
committed
Pass strings to FT2Font -- never Unicode strings.
svn path=/trunk/matplotlib/; revision=8269
1 parent 8048397 commit 0af3c48

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/matplotlib/backends/backend_pdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ def createType1Descriptor(self, t1font, fontfile):
654654
if 0: flags |= 1 << 17 # TODO: small caps
655655
if 0: flags |= 1 << 18 # TODO: force bold
656656

657-
ft2font = FT2Font(fontfile)
657+
ft2font = FT2Font(str(fontfile))
658658

659659
descriptor = {
660660
'Type': Name('FontDescriptor'),

lib/matplotlib/backends/backend_ps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ def write(self, *kl, **kwargs):
11041104
if not rcParams['ps.useafm']:
11051105
for font_filename, chars in ps_renderer.used_characters.values():
11061106
if len(chars):
1107-
font = FT2Font(font_filename)
1107+
font = FT2Font(str(font_filename))
11081108
cmap = font.get_charmap()
11091109
glyph_ids = []
11101110
for c in chars:

lib/matplotlib/mathtext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ def _get_font(self, font):
597597

598598
cached_font = self._fonts.get(basename)
599599
if cached_font is None:
600-
font = FT2Font(basename)
600+
font = FT2Font(str(basename))
601601
cached_font = self.CachedFont(font)
602602
self._fonts[basename] = cached_font
603603
self._fonts[font.postscript_name] = cached_font

lib/matplotlib/textpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def get_glyphs_tex(self, prop, s, glyph_map=None,
311311

312312
if font_and_encoding is None:
313313
font_bunch = self.tex_font_map[dvifont.texname]
314-
font = FT2Font(font_bunch.filename)
314+
font = FT2Font(str(font_bunch.filename))
315315
try:
316316
font.select_charmap(1094992451) # select ADOBE_CUSTOM
317317
except ValueError:

0 commit comments

Comments
 (0)