René's URL Explorer Experiment


Title: [Bug]: savefig to PNG raises 'failed to load glyph' for small text in macOS Helvetica (Regular) with matplotlib 3.11.0 and 3.11.2 · Issue #32650 · matplotlib/matplotlib · GitHub

Open Graph Title: [Bug]: savefig to PNG raises 'failed to load glyph' for small text in macOS Helvetica (Regular) with matplotlib 3.11.0 and 3.11.2 · Issue #32650 · matplotlib/matplotlib

X Title: [Bug]: savefig to PNG raises 'failed to load glyph' for small text in macOS Helvetica (Regular) with matplotlib 3.11.0 and 3.11.2 · Issue #32650 · matplotlib/matplotlib

Description: Bug summary With matplotlib 3.11.0 and 3.11.2 and default rcParams, saving a figure to PNG raises RuntimeError: failed to load glyph when it has text in the regular face of macOS's Helvetica at 7 pixels per em or fewer, such as 5 pt text...

Open Graph Description: Bug summary With matplotlib 3.11.0 and 3.11.2 and default rcParams, saving a figure to PNG raises RuntimeError: failed to load glyph when it has text in the regular face of macOS's Helvetica at 7 p...

X Description: Bug summary With matplotlib 3.11.0 and 3.11.2 and default rcParams, saving a figure to PNG raises RuntimeError: failed to load glyph when it has text in the regular face of macOS's Helvetica at...

Opengraph URL: https://github.com/matplotlib/matplotlib/issues/32650

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: savefig to PNG raises 'failed to load glyph' for small text in macOS Helvetica (Regular) with matplotlib 3.11.0 and 3.11.2","articleBody":"### Bug summary\n\nWith matplotlib 3.11.0 and 3.11.2 and default rcParams, saving a figure to PNG raises `RuntimeError: failed to load glyph` when it has text in the regular face of macOS's Helvetica at 7 pixels per em or fewer, such as 5 pt text at 72 dpi. matplotlib 3.10.9 saves the same figure. With 3.11.2, saving it as PDF, SVG, PS or EPS works.\n\n### Code for reproduction\n\n```Python\n# macOS only: 'Helvetica' must resolve to /System/Library/Fonts/Helvetica.ttc\nimport matplotlib\nmatplotlib.use(\"Agg\")\nimport matplotlib.pyplot as plt\n\nfig = plt.figure(figsize=(2, 1))\nfig.text(0.1, 0.5, \"yield\", fontfamily=\"Helvetica\", fontsize=5)\nfig.savefig(\"out.png\", dpi=72)\n```\n\n### Actual outcome\n\n```\nTraceback (most recent call last):\n  File \"/Users/runner/work/depictr-py/depictr-py/diag/report_snippet.py\", line 7, in \u003cmodule>\n    fig.savefig(\"out.png\", dpi=72)\n    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^\n  File \".../site-packages/matplotlib/figure.py\", line 3515, in savefig\n    self.canvas.print_figure(fname, **kwargs)\n    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\n  File \".../site-packages/matplotlib/backend_bases.py\", line 2289, in print_figure\n    result = print_method(\n        filename,\n    ...\u003c3 lines>...\n        bbox_inches_restore=_bbox_inches_restore,\n        **kwargs)\n  File \".../site-packages/matplotlib/backend_bases.py\", line 2146, in \u003clambda>\n    print_method = functools.wraps(meth)(lambda *args, **kwargs: meth(\n                                                                 ~~~~^\n        *args, **{k: v for k, v in kwargs.items() if k not in skip}))\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \".../site-packages/matplotlib/backends/backend_agg.py\", line 537, in print_png\n    self._print_pil(filename_or_obj, \"png\", pil_kwargs, metadata)\n    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \".../site-packages/matplotlib/backends/backend_agg.py\", line 485, in _print_pil\n    FigureCanvasAgg.draw(self)\n    ~~~~~~~~~~~~~~~~~~~~^^^^^^\n  File \".../site-packages/matplotlib/backends/backend_agg.py\", line 438, in draw\n    self.figure.draw(self.renderer)\n    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^\n  File \".../site-packages/matplotlib/artist.py\", line 94, in draw_wrapper\n    result = draw(artist, renderer, *args, **kwargs)\n  File \".../site-packages/matplotlib/artist.py\", line 71, in draw_wrapper\n    return draw(artist, renderer)\n  File \".../site-packages/matplotlib/figure.py\", line 3282, in draw\n    mimage._draw_list_compositing_images(\n    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n        renderer, self, artists, self.suppressComposite)\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \".../site-packages/matplotlib/image.py\", line 133, in _draw_list_compositing_images\n    a.draw(renderer)\n    ~~~~~~^^^^^^^^^^\n  File \".../site-packages/matplotlib/artist.py\", line 71, in draw_wrapper\n    return draw(artist, renderer)\n  File \".../site-packages/matplotlib/text.py\", line 853, in draw\n    bbox, info, _ = self._get_layout(renderer)\n                    ~~~~~~~~~~~~~~~~^^^^^^^^^^\n  File \".../site-packages/matplotlib/text.py\", line 479, in _get_layout\n    w, h, d = _get_text_metrics_with_cache(\n              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n        renderer, clean_line, self._fontproperties,\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n        ismath=ismath, dpi=self.get_figure(root=True).dpi)\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \".../site-packages/matplotlib/text.py\", line 59, in _get_text_metrics_with_cache\n    return get_text_metrics(text, fontprop.copy(), ismath, dpi)\n  File \".../site-packages/matplotlib/text.py\", line 125, in _text_metrics\n    return local_renderer.get_text_width_height_descent(text, fontprop, ismath)\n           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^\n  File \".../site-packages/matplotlib/backends/backend_agg.py\", line 263, in get_text_width_height_descent\n    font.set_text(s, 0.0, flags=get_hinting_flag())\n    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nRuntimeError: failed to load glyph\n```\n\n(3.11.2 on macOS 26.7.2. `...` stands for `/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13`.)\n\n### Expected outcome\n\nThe figure is saved, as it is with 3.10.9.\n\n### Additional information\n\n`FT2Font.load_glyph` on the same face, size and flags reports the FreeType error that `set_text` leaves out of its message (src/ft2font.cpp lines 477 to 479 in 3.11.2):\n\n```python\nfrom matplotlib.ft2font import FT2Font, LoadFlags\n\nfont = FT2Font(\"/System/Library/Fonts/Helvetica.ttc\")\nfont.set_size(5, 72)\nfont.load_glyph(font.get_char_index(ord(\"y\")), flags=LoadFlags.DEFAULT)\n# RuntimeError: FT_Load_Glyph (ft2font.cpp line 646) failed with error 0x85: division by zero\n```\n\nThe error appears only with the font's native hinter (`LoadFlags.DEFAULT` or `NO_AUTOHINT`), only in face 0 of the six faces in Helvetica.ttc and only at 7 px/em or fewer (whole sizes from 1 to 15 tested). FreeType 2.14.3 is the copy bundled with 3.11.0 and 3.11.2. FreeType 2.6.1 (the copy in 3.10.9, with `FT2Font(path, hinting_factor=1)`), 2.13.2 and 2.15.0 (both called through ctypes) return the same error, and they load the glyph when the horizontal resolution is 8 times the vertical one, as 3.10.9's default `hinting_factor` of 8 made it. So the font's own hinting instructions appear to fail at these sizes in every FreeType version tried. 3.10.9's defaults did not run them at these sizes: its `text.hinting` default was 'force_autohint', and its hinting factor raised the horizontal resolution. 3.11 changed the `text.hinting` default to 'default' (#29816) and dropped the hinting factor (#31521). I could not find the `text.hinting` change in the 3.11.0 API changes.\n\nAs a workaround, setting `plt.rcParams[\"text.hinting\"]` to `\"force_autohint\"` or `\"no_hinting\"` saves the figure with 3.11.0 and 3.11.2. A downstream project, Tavotto, hit the same error with matplotlib 3.11.2 and now retries a failing call with `text.hinting` set to `\"no_hinting\"` (Tavotto/Tavotto#1872). This differs from #32063, where text in fonts with embedded bitmap strikes comes out blank: here the figure is not saved at all.\n\nTwo changes may be worth considering. One is, when `FT_Load_Glyph` fails with hinting enabled, to lay out and load the text again without hinting or with the auto-hinter, with a warning, because `FT2Font::layout` passes the same load flags to raqm (src/ft2font.cpp line 328). The other is to mention the new `text.hinting` default in the 3.11 API changes. On main, #32120 loads these glyphs through `FT_CHECK`, so the message will name FreeType's error from 3.12. The hinting default and the load flags are unchanged there, so I expect the same failure, although I have not run main.\n\nTested on GitHub Actions runners with macOS 15.8.2 and 26.7.2 (arm64), Python 3.13.17 and wheels from PyPI. Scripts: https://github.com/pablobernabeu/depictr-py/tree/61ad513081f9000392838bd7e975e5232b5c3864/diag. Logs: [mpl_only.py](https://github.com/pablobernabeu/depictr-py/actions/runs/43752353059), [ft_versions.py](https://github.com/pablobernabeu/depictr-py/actions/runs/43752929088), [hinting_factor.py](https://github.com/pablobernabeu/depictr-py/actions/runs/43753177369), [the snippets above](https://github.com/pablobernabeu/depictr-py/actions/runs/43753483025) and [font_info.py](https://github.com/pablobernabeu/depictr-py/actions/runs/43754764722). I found it through plotnine, whose default theme lists Helvetica first among its sans-serif fonts.\n\n### Operating system\n\nmacOS 15.8.2 and macOS 26.7.2 (arm64)\n\n### Matplotlib Version\n\n3.11.2 and 3.11.0 (3.11.1 not tested). 3.10.9 is not affected.\n\n### Matplotlib Backend\n\nagg\n\n### Python version\n\n3.13.17\n\n### Jupyter version\n\nNot used\n\n### Installation\n\npip","author":{"url":"https://github.com/pablobernabeu","@type":"Person","name":"pablobernabeu"},"datePublished":"2026-11-22T23:26:56Z","url":"https://github.com/matplotlib/matplotlib/issues/32650"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:74990dbf-0580-255e-7f6f-1548e7be22e8
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD870:3CDC55:94E552:C7D3AF:6B064EDF
html-safe-noncec5edefca3d47915a5be1973b6d92219be85c32932c240050626ae695c7636797
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODcwOjNDREM1NTo5NEU1NTI6QzdEM0FGOjZCMDY0RURGIiwidmlzaXRvcl9pZCI6IjgzNzgzMjMxNDQyNTk1NTUwMzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac17b958634a6873a3f6d62715c3a4402cea2cda6a075bce1439ac8746817c8e4f
hovercard-subject-tagissue:6549196325
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/32650/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c639436ba2509b3de0aecd03dd9ba5a82091ee7789229e0b96085fc2c684d265/matplotlib/matplotlib/issues/32650
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c639436ba2509b3de0aecd03dd9ba5a82091ee7789229e0b96085fc2c684d265/matplotlib/matplotlib/issues/32650
og:image:altBug summary With matplotlib 3.11.0 and 3.11.2 and default rcParams, saving a figure to PNG raises RuntimeError: failed to load glyph when it has text in the regular face of macOS's Helvetica at 7 p...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepablobernabeu
hostnamegithub.com
expected-hostnamegithub.com
None772b6997ca4daa0428dd49a25d76052e765555ae560fe9c88517eb828bbd861e
turbo-cache-controlno-preview
go-importgithub.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git
octolytics-dimension-user_id215947
octolytics-dimension-user_loginmatplotlib
octolytics-dimension-repository_id1385122
octolytics-dimension-repository_nwomatplotlib/matplotlib
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1385122
octolytics-dimension-repository_network_root_nwomatplotlib/matplotlib
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef1f9a08f7c769a37f1dfc18ad43d463c222a7eea
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/matplotlib/matplotlib/issues/32650#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F32650
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F32650
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=matplotlib%2Fmatplotlib
Reloadhttps://github.com/matplotlib/matplotlib/issues/32650
Reloadhttps://github.com/matplotlib/matplotlib/issues/32650
Reloadhttps://github.com/matplotlib/matplotlib/issues/32650
matplotlibhttps://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Codehttps://github.com/matplotlib/matplotlib
Issues1k (1k)https://github.com/matplotlib/matplotlib/issues
Pull requests430 (430)https://github.com/matplotlib/matplotlib/pulls
Actionshttps://github.com/matplotlib/matplotlib/actions
Projectshttps://github.com/matplotlib/matplotlib/projects
Wikihttps://github.com/matplotlib/matplotlib/wiki
Security and qualityhttps://github.com/matplotlib/matplotlib/security
Insightshttps://github.com/matplotlib/matplotlib/insights
https://github.com/matplotlib/matplotlib
New issuehttps://github.com/login?return_to=https://github.com/matplotlib/matplotlib/issues/32650
New issuehttps://github.com/login?return_to=https://github.com/matplotlib/matplotlib/issues/32650
#32651https://github.com/matplotlib/matplotlib/pull/32651
[Bug]: savefig to PNG raises 'failed to load glyph' for small text in macOS Helvetica (Regular) with matplotlib 3.11.0 and 3.11.2https://github.com/matplotlib/matplotlib/issues/32650#top
#32651https://github.com/matplotlib/matplotlib/pull/32651
OS: Applehttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22OS%3A%20Apple%22
first-contributionhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22first-contribution%22
status: confirmed bughttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22status%3A%20confirmed%20bug%22
https://github.com/pablobernabeu
pablobernabeuhttps://github.com/pablobernabeu
on Nov 22, 2026https://github.com/matplotlib/matplotlib/issues/32650#issue-6549196325
#29816https://github.com/matplotlib/matplotlib/pull/29816
#31521https://github.com/matplotlib/matplotlib/pull/31521
Tavotto/Tavotto#1872https://github.com/Tavotto/Tavotto/pull/1872
#32063https://github.com/matplotlib/matplotlib/issues/32063
#32120https://github.com/matplotlib/matplotlib/pull/32120
https://github.com/pablobernabeu/depictr-py/tree/61ad513081f9000392838bd7e975e5232b5c3864/diaghttps://github.com/pablobernabeu/depictr-py/tree/61ad513081f9000392838bd7e975e5232b5c3864/diag
mpl_only.pyhttps://github.com/pablobernabeu/depictr-py/actions/runs/43752353059
ft_versions.pyhttps://github.com/pablobernabeu/depictr-py/actions/runs/43752929088
hinting_factor.pyhttps://github.com/pablobernabeu/depictr-py/actions/runs/43753177369
the snippets abovehttps://github.com/pablobernabeu/depictr-py/actions/runs/43753483025
font_info.pyhttps://github.com/pablobernabeu/depictr-py/actions/runs/43754764722
github-actionshttps://github.com/apps/github-actions
first-contributionhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22first-contribution%22
on Nov 22, 2026https://github.com/matplotlib/matplotlib/issues/32650#event-36954442346
iccirhttps://github.com/iccir
OS: Applehttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22OS%3A%20Apple%22
on Nov 23, 2026https://github.com/matplotlib/matplotlib/issues/32650#event-36970017285
https://github.com/iccir
iccirhttps://github.com/iccir
on Nov 23, 2026https://github.com/matplotlib/matplotlib/issues/32650#issuecomment-7092149773
iccirhttps://github.com/iccir
status: confirmed bughttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22status%3A%20confirmed%20bug%22
on Nov 23, 2026https://github.com/matplotlib/matplotlib/issues/32650#event-36971923732
Sign up for freehttps://github.com/signup?return_to=https://github.com/matplotlib/matplotlib/issues/32650
Sign in to commenthttps://github.com/login?return_to=https://github.com/matplotlib/matplotlib/issues/32650
OS: Applehttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22OS%3A%20Apple%22
first-contributionhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22first-contribution%22
status: confirmed bughttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22status%3A%20confirmed%20bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.