Skip to content

Commit f10da0c

Browse files
committed
Add what's new entry about fixed kerning.
1 parent a1df646 commit f10da0c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Kerning adjustments now use correct values
2+
------------------------------------------
3+
4+
Due to an error in how kerning adjustments were applied, previous versions of
5+
Matplotlib would under-correct kerning. This version will now correctly apply
6+
kerning (for fonts supported by FreeType). To restore the old behavior (e.g.,
7+
for test images), you may set :rc:`text.kerning_factor` to 6 (instead of 0).
8+
Other values have undefined behavior.
9+
10+
.. plot::
11+
12+
import matplotlib.pyplot as plt
13+
14+
# Use old kerning values:
15+
plt.rcParams['text.kerning_factor'] = 6
16+
fig, ax = plt.subplots()
17+
ax.text(0.0, 0.05, 'BRAVO\nAWKWARD\nVAT\nW.Test', fontsize=56)
18+
ax.set_title('Before (text.kerning_factor = 6)')
19+
20+
Note how the spacing between characters is uniform between their bounding boxes
21+
(above). With corrected kerning (below), slanted characters (e.g., AV or VA)
22+
will be spaced closer together, as well as various other character pairs,
23+
depending on font support (e.g., T and e, or the period after the W).
24+
25+
.. plot::
26+
27+
import matplotlib.pyplot as plt
28+
29+
# Use new kerning values:
30+
plt.rcParams['text.kerning_factor'] = 0
31+
fig, ax = plt.subplots()
32+
ax.text(0.0, 0.05, 'BRAVO\nAWKWARD\nVAT\nW.Test', fontsize=56)
33+
ax.set_title('After (text.kerning_factor = 0)')

0 commit comments

Comments
 (0)