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

Skip to content

Commit a2876b3

Browse files
committed
Few cleanups
1 parent 365801d commit a2876b3

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

lib/matplotlib/backends/backend_pdf.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,6 @@ def __init__(self, filename, metadata=None):
692692
# differently encoded Type-1 fonts may share the same descriptor
693693
self.type1Descriptors = {}
694694
self._character_tracker = _backend_pdf_ps.CharacterTracker()
695-
# self._char_to_font = None
696695

697696
self.alphaStates = {} # maps alpha values to graphics state objects
698697
self._alpha_state_seq = (Name(f'A{i}') for i in itertools.count(1))
@@ -916,7 +915,6 @@ def dviFontName(self, dvifont):
916915
return pdfname
917916

918917
def writeFonts(self):
919-
print("fonts: ", self.fontNames)
920918
fonts = {}
921919
for dviname, info in sorted(self.dviFontInfo.items()):
922920
Fx = info.pdfname
@@ -933,7 +931,6 @@ def writeFonts(self):
933931
# a normal TrueType font
934932
_log.debug('Writing TrueType font.')
935933
chars = self._character_tracker.used.get(filename)
936-
print("chars:", chars, " for font:", filename)
937934
if chars:
938935
fonts[Fx] = self.embedTTF(filename, chars)
939936
self.writeObject(self.fontObject, fonts)
@@ -1076,11 +1073,10 @@ def createType1Descriptor(self, t1font, fontfile):
10761073

10771074
def _get_xobject_symbol_name(self, filename, symbol_name):
10781075
Fx = self.fontName(filename)
1079-
x = "-".join([
1076+
return "-".join([
10801077
Fx.name.decode(),
10811078
os.path.splitext(os.path.basename(filename))[0],
10821079
symbol_name])
1083-
return x
10841080

10851081
_identityToUnicodeCMap = b"""/CIDInit /ProcSet findresource begin
10861082
12 dict begin
@@ -1107,7 +1103,6 @@ def embedTTF(self, filename, characters):
11071103
"""Embed the TTF font from the named file into the document."""
11081104

11091105
font = get_font(filename)
1110-
print("embedding:", font.fname)
11111106
fonttype = mpl.rcParams['pdf.fonttype']
11121107

11131108
def cvt(length, upe=font.units_per_EM, nearest=True):
@@ -1339,7 +1334,7 @@ def embedTTFType42(font, characters, descriptor):
13391334
# Add XObjects for unsupported chars
13401335
glyph_ids = []
13411336
for ccode in characters:
1342-
if _font_supports_char(fonttype, chr(ccode)):
1337+
if not _font_supports_char(fonttype, chr(ccode)):
13431338
gind = full_font.get_char_index(ccode)
13441339
glyph_ids.append(gind)
13451340

@@ -1929,8 +1924,6 @@ class RendererPdf(_backend_pdf_ps.RendererPDFPSBase):
19291924
def __init__(self, file, image_dpi, height, width):
19301925
super().__init__(width, height)
19311926
self.file = file
1932-
self.char_to_font = {}
1933-
self.glyph_to_font = {}
19341927
self.gc = self.new_gc()
19351928
self.image_dpi = image_dpi
19361929

@@ -2421,7 +2414,6 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
24212414
# Emit all the 1-byte characters in a BT/ET group.
24222415

24232416
self.file.output(Op.begin_text)
2424-
# ft, fontsize, Op.selectfont
24252417
prev_start_x = 0
24262418
for ft_object, start_x, kerns_or_chars in singlebyte_chunks:
24272419
ft_name = self.file.fontName(ft_object.fname)

src/ft2font.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ int FT2Font::get_kerning(FT_UInt left, FT_UInt right, FT_UInt mode, bool fallbac
443443
FT2Font *left_ft_object = glyph_to_font[left];
444444
FT2Font *right_ft_object = glyph_to_font[right];
445445
if (left_ft_object != right_ft_object) {
446-
printf("Prev FT2Font != Curr FT2Font!\n");
446+
// could potentially do something different?
447447
}
448448
// if left_ft_object is not the same the right_ft_object,
449449
// do the exact same thing which set_text does.

0 commit comments

Comments
 (0)