Skip to content

Conversation

@anntzer
Copy link
Contributor

@anntzer anntzer commented Jun 7, 2019

Previously, we would guess that "Times New Roman Bold" is a regular
weight font because its name contains the substring "Roman", even though
the font correctly sets the BOLD flag (FT_STYLE_FLAG_BOLD). Invert the
logic to give priority to the flag, as its presence is clearly more
robust than a substring check.

s.find(w) >= 0 is just an obfuscated way to write w in s, so change
that.

Obviously font properties extraction could be improved in a lot of ways, but this should close #5574.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@dstansby
Copy link
Member

dstansby commented Jun 7, 2019

Should probably get a short API change note.

Previously, we would guess that "Times New Roman Bold" is a regular
weight font because its name contains the substring "Roman", even though
the font correctly sets the BOLD flag (FT_STYLE_FLAG_BOLD).  Invert the
logic to give priority to the flag, as its presence is clearly more
robust than a substring check.

`s.find(w) >= 0` is just an obfuscated way to write `w in s`, so change
that.
@anntzer
Copy link
Contributor Author

anntzer commented Jun 7, 2019

sure, done

@dstansby dstansby added this to the v3.2.0 milestone Jun 7, 2019
@QuLogic QuLogic merged commit 0e53685 into matplotlib:master Jun 8, 2019
@anntzer anntzer deleted the timesnewroman branch June 8, 2019 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect selection of Times New Roman Bold

3 participants