Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: Check for fontsize smaller than 1 pt and round up #10010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/api/api_changes/2017-12-14-JMK.rst
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 4 additions & 0 deletions lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down