| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Sorry, something went wrong.
|
done |
Sorry, something went wrong.
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). 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.
| Back | FazBrowse Home | New Git URL |
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