-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deprecate various vector-backend-specific mathtext helpers. #18002
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
46d9fd6
to
ea114bb
Compare
@@ -2072,6 +2078,7 @@ def draw_mathtext(self, gc, x, y, s, prop, angle): | |||
0.001 * fontsize, 0, | |||
0, 0.001 * fontsize, | |||
ox, oy, Op.concat_matrix) | |||
symbol_name = font.get_glyph_name(font.get_char_index(num)) |
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.
There are some fallbacks; do we need to worry about those here:
matplotlib/lib/matplotlib/mathtext.py
Lines 690 to 697 in 03aebfb
if font is not None: | |
gid = font.get_char_index(num) | |
if gid != 0: | |
symbol_name = font.get_glyph_name(gid) | |
if symbol_name is None: | |
return self._stix_fallback._get_glyph( | |
fontname, font_class, sym, fontsize, math) |
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.
No, because _stix_fallback._get_glyph(...) will return a different font object (for which the glyph exists). This can be checked e.g. with
rcParams["mathtext.fontset"] = "cm"; figtext(.5, .5, "$\\perp$"); savefig("/tmp/out.pdf")
adding a print to check that fallback occurs. (Actually it looks like this should not fallback as there's a \perp sign in cmsy10.ttf? but that's a separate issue.)
A single mathtext "backend" yielding a list of glyphs and rectangles is enough; renderer-specific logic can be implemented in the renderer themselves. (MathtextBackendAgg needs to stay separate because it uses a different font hinting flag.)
A single mathtext "backend" yielding a list of glyphs and rectangles is
enough; renderer-specific logic can be implemented in the renderer
themselves.
(MathtextBackendAgg needs to stay separate because it uses a different
font hinting flag.)
PR Summary
PR Checklist