Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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
timhoffm approved these changesJan 13, 2019
tacaswell approved these changesJan 13, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
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.
This was referencedJan 14, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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