-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add what's new entry about fixed kerning.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)') |