Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 91e7425

Browse filesBrowse files
authored
Merge pull request #7961 from jkseppan/issue7937
Compute glyph widths similarly in Type 42 as in Type 3
2 parents 939747e + 4b28d78 commit 91e7425
Copy full SHA for 91e7425

File tree

Expand file treeCollapse file tree

3 files changed

+16
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+16
-2
lines changed

‎lib/matplotlib/backends/backend_pdf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pdf.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,9 @@ def embedTTFType42(font, characters, descriptor):
10401040
for c in characters:
10411041
ccode = c
10421042
gind = font.get_char_index(ccode)
1043-
glyph = font.load_char(ccode, flags=LOAD_NO_HINTING)
1044-
widths.append((ccode, glyph.horiAdvance / 6))
1043+
glyph = font.load_char(ccode,
1044+
flags=LOAD_NO_SCALE | LOAD_NO_HINTING)
1045+
widths.append((ccode, cvt(glyph.horiAdvance)))
10451046
if ccode < 65536:
10461047
cid_to_gid_map[ccode] = unichr(gind)
10471048
max_ccode = max(ccode, max_ccode)
Binary file not shown.

‎lib/matplotlib/tests/test_text.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_text.py
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,3 +411,16 @@ def test_text_size_binding():
411411
matplotlib.rcParams['font.size'] = 100
412412

413413
assert sz1 == fp.get_size_in_points()
414+
415+
416+
@image_comparison(baseline_images=['font_scaling'],
417+
extensions=['pdf'])
418+
def test_font_scaling():
419+
matplotlib.rcParams['pdf.fonttype'] = 42
420+
fig, ax = plt.subplots(figsize=(6.4, 12.4))
421+
ax.xaxis.set_major_locator(plt.NullLocator())
422+
ax.yaxis.set_major_locator(plt.NullLocator())
423+
ax.set_ylim(-10, 600)
424+
425+
for i, fs in enumerate(range(4, 43, 2)):
426+
ax.text(0.1, i*30, "{fs} pt font size".format(fs=fs), fontsize=fs)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.