Skip to content

Commit

Permalink
Add what's new entry about fixed kerning.
Browse files Browse the repository at this point in the history
  • Loading branch information
QuLogic committed Aug 14, 2019
1 parent 28e2395 commit 72604cf
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions doc/users/next_whats_new/2019-08-14-ES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Kerning adjustments now use correct values
------------------------------------------

Due to an error in how kerning adjustments were applied, previous versions of
Matplotlib would under-correct kerning. This version will now correctly apply
kerning (for fonts supported by FreeType). To restore the old behavior (e.g.,
for test images), you may set :rc:`text.kerning_factor` to 6 (instead of 0).
Other values have undefined behavior.

.. plot::

import matplotlib.pyplot as plt

# Use old kerning values:
plt.rcParams['text.kerning_factor'] = 6
fig, ax = plt.subplots()
ax.text(0.0, 0.05, 'BRAVO\nAWKWARD\nVAT\nW.Test', fontsize=56)
ax.set_title('Before (text.kerning_factor = 6)')

Note how the spacing between characters is uniform between their bounding boxes
(above). With corrected kerning (below), slanted characters (e.g., AV or VA)
will be spaced closer together, as well as various other character pairs,
depending on font support (e.g., T and e, or the period after the W).

.. plot::

import matplotlib.pyplot as plt

# Use new kerning values:
plt.rcParams['text.kerning_factor'] = 0
fig, ax = plt.subplots()
ax.text(0.0, 0.05, 'BRAVO\nAWKWARD\nVAT\nW.Test', fontsize=56)
ax.set_title('After (text.kerning_factor = 0)')

0 comments on commit 72604cf

Please sign in to comment.