diff --git a/doc/api/api_changes/2017-12-14-JMK.rst b/doc/api/api_changes/2017-12-14-JMK.rst new file mode 100644 index 000000000000..f1051a1d5f3f --- /dev/null +++ b/doc/api/api_changes/2017-12-14-JMK.rst @@ -0,0 +1,10 @@ +Fontsizes less than 1 pt are clipped to be 1 pt. +------------------------------------------------ + +FreeType doesn't allow fonts to get smaller than 1 pt, so all Agg +backends were silently rounding up to 1 pt. PDF (other vector +backends?) were letting us write fonts that were less than 1 pt, but +they could not be placed properly because position information comes from +FreeType. This change makes it so no backends can use fonts smaller than +1 pt, consistent with FreeType and ensuring more consistent results across +backends. diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index 71b09fa4bb79..5364413bfd40 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -875,6 +875,10 @@ def set_size(self, size): + ", ".join(map(str, font_scalings))) else: size = scale * FontManager.get_default_size() + if size < 1.0: + _log.info('Fontsize %1.2f < 1.0 pt not allowed by FreeType. ' + 'Setting fontsize = 1 pt', size) + size = 1.0 self._size = size def set_file(self, file):