Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Don't try to find TeX-only fonts when layouting TeX text.#13170

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 1 commit intomatplotlib:masterfromanntzer:preprocess_math
Jan 14, 2019

Conversation

anntzer
Copy link
Contributor

PR Summary

Text.is_math_text is only ever called with self.get_usetex() as second
argument, so just change it to a private method (Text._preprocess_math)
that calls self.get_usetex() internally; deprecate is_math_text which
is clearly a private internal helper. This also helps clarifying that
usetex mode is only ever called if self.get_usetex() is True (in the
textobj.is_math_text(...) line, textobj is actually the same object(!)
as self so shares the same get_usetex() value).
(#13166 also clarifies the situation with get_usetex()).

In Text._get_layout, if self.get_usetex() is True (and only in that
case), self._fontproperties can refer to a TeX-only font (e.g. "Computer
Modern Roman"). If that's the case, don't try to call
renderer.get_text_width_height_descent with ismath=False, as that would
trigger a font resolution that can fail (perhaps there's no "Computer
Modern Roman" font available in the font cache; it may only be available
to TeX) and cause a spurious warning.

Goes on top of#12951 to avoid a rebase.
Closes (probably)#13139, at least#13139 (comment).

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 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

@tacaswelltacaswell added this to thev3.1 milestoneJan 13, 2019
Copy link
Member

@tacaswelltacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@anntzer mild preference that you do the (hopefully trivial) rebase to drop the now-merged commit from#12951

@anntzer
Copy link
ContributorAuthor

done

Text.is_math_text is only ever called with self.get_usetex() as secondargument, so just change it to a private method (Text._preprocess_math)that calls self.get_usetex() internally; deprecate is_math_text whichis clearly a private internal helper.  This also helps clarifying thatusetex mode is only ever called if self.get_usetex() is True (in thetextobj.is_math_text(...) line, textobj is actually the same object(!)as self so shares the same get_usetex() value).In Text._get_layout, if self.get_usetex() is True (and only in thatcase), self._fontproperties can refer to a TeX-only font (e.g. "ComputerModern Roman").  If that's the case, don't try to callrenderer.get_text_width_height_descent with ismath=False, as that wouldtrigger a font resolution that can fail (perhaps there's no "ComputerModern Roman" font available in the font cache; it may only be availableto TeX) and cause a spurious warning.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.1.0
Development

Successfully merging this pull request may close these issues.

3 participants
@anntzer@tacaswell@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp