FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Improve font weight guessing. by anntzer · Pull Request #14483 · matplotlib/matplotlib · GitHub

Repository navigation

Improve font weight guessing. - #14483

Merged
QuLogic merged 1 commit into
matplotlib:masterfrom
anntzer:timesnewroman
Jun 8, 2019
Merged

QuLogic merged 1 commit into
matplotlib:masterfrom
anntzer:timesnewroman

Conversation

anntzer commented Jun 7, 2019

Copy link
Copy Markdown
Contributor

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 commented Jun 7, 2019

Copy link
Copy Markdown
Member

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 commented Jun 7, 2019

Copy link
Copy Markdown
Contributor Author

sure, done

dstansby added this to the v3.2.0 milestone Jun 7, 2019
QuLogic merged commit 0e53685 into matplotlib:master Jun 8, 2019
anntzer deleted the timesnewroman branch June 8, 2019 08:56
This file contains hidden or 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
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


Back | FazBrowse Home | New Git URL