Title: Feature request: allow mathtext fallback font other than Computer Modern for custom mathtext setup · Issue #8619 · matplotlib/matplotlib · GitHub
Open Graph Title: Feature request: allow mathtext fallback font other than Computer Modern for custom mathtext setup · Issue #8619 · matplotlib/matplotlib
X Title: Feature request: allow mathtext fallback font other than Computer Modern for custom mathtext setup · Issue #8619 · matplotlib/matplotlib
Description: Feature request Feature summary Allow users to specify a mathtext fallback font when custom mathtext font lacks a needed character. More detail Currently, a user can choose a font for the mathtext. For example, to use Open Sans for text ...
Open Graph Description: Feature request Feature summary Allow users to specify a mathtext fallback font when custom mathtext font lacks a needed character. More detail Currently, a user can choose a font for the mathtext....
X Description: Feature request Feature summary Allow users to specify a mathtext fallback font when custom mathtext font lacks a needed character. More detail Currently, a user can choose a font for the mathtext....
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/8619
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Feature request: allow mathtext fallback font other than Computer Modern for custom mathtext setup","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Feature request\r\n\r\n**Feature summary**\r\n\r\nAllow users to specify a mathtext fallback font when custom mathtext font lacks a needed character.\r\n\r\n**More detail**\r\n\r\nCurrently, a user can choose a font for the mathtext. For example, to use Open Sans for text and math, you can do:\r\n```\r\nrcParams['font.sans-serif'] = 'open sans'\r\nrcParams['mathtext.fontset'] = 'custom'\r\nrcParams['mathtext.it'] = 'sans:italic'\r\n```\r\nOpen Sans has pretty good coverage of the characters needed for plots, including the Greek alphabet, but it's missing, for example, a character that maps to the latex command `$\\phi$` (it's phi maps to `$\\varphi$`). If you use the above configuration with textbox containing `$\\phi$`, the system falls back to computer modern, in accordance with the `fallback_to_cm` rc parameter. It would be nice, however, to be able to fall back to a similar font for that character, preferable a sans serif font in a comparable weight.\r\n\r\nThis is already implemented for the default DejaVu Sans. It falls back to Stix Sans instead of CM to get a more uniform look. (In the `DejaVuFonts` class, the line \r\n```\r\nself.cm_fallback = StixSansFonts(*args, **kwargs)\r\n```\r\nsets this.)\r\n\r\nIn my example with Open Sans, I can get a better result by changing the line\r\n```\r\nself.cm_fallback = BakomaFonts(*args, **kwargs)\r\n```\r\nto\r\n```\r\nself.cm_fallback = DejaVuSansFonts(*args, **kwargs)\r\n```\r\nin the `UnicodeFonts` class. That way, the fallback is a sans-serif font similar to the main font. \r\n\r\nIt seems like it would be fairly easy to allow users to set the fallback to one of the built-in fonts (cm, dejavuserif, dejavusans, stix, stixsans). It would be nice to also allow custom fallbacks (but then we might need to have a fallback for the fallback in case the custom choice lacks a needed character). In my example, you might want to set the main font in Open Sans, but the fallback to Noto Sans (a very similar Google font with more characters).\r\n\r\nThere are many high-quality free (and not free) fonts that would benefit from a fallback that's not computer modern. This feature would therefore increase the number of usable custom fontsets.\r\n\r\n**Implementation questions**\r\nI'd be happy to try implementing this myself, but I'm a new contributor, and I'm sure I'd mess some things up. Here are a few questions that come to mind:\r\n1. Is this feature worth implementing?\r\n2. It would probably require a change to the rc parameters. Is there a policy in place for doing so?\r\n3. Like I mentioned above, allowing users to choose from one of the built-in fonts would be pretty straightforward. Is it worth also allowing custom fallbacks?","author":{"url":"https://github.com/geib7592","@type":"Person","name":"geib7592"},"datePublished":"2017-05-14T21:13:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/8619/matplotlib/issues/8619"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9a94a0dd-92e1-eee9-038e-7920638a68a8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A35E:1F7C65:969CFE:CB2F24:6A54256B |
| html-safe-nonce | ca5ee4b5ab8fbaf3ea4121ba6855a9926f632918ae5513cb48b7dc60ab0b25bc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzVFOjFGN0M2NTo5NjlDRkU6Q0IyRjI0OjZBNTQyNTZCIiwidmlzaXRvcl9pZCI6IjU5NjQ0MjE5MTAzNzI4MjAzMzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 00da3fdede82f07604e780b33c9feb548fdc338fa627315bfdd18c6d2b4300c1 |
| hovercard-subject-tag | issue:228570664 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/8619/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a48f2bd53f95092ba11f565d974aa9de0a52e4e92a21408b35e1f0a1b5aaca69/matplotlib/matplotlib/issues/8619 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a48f2bd53f95092ba11f565d974aa9de0a52e4e92a21408b35e1f0a1b5aaca69/matplotlib/matplotlib/issues/8619 |
| og:image:alt | Feature request Feature summary Allow users to specify a mathtext fallback font when custom mathtext font lacks a needed character. More detail Currently, a user can choose a font for the mathtext.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | geib7592 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width