René's URL Explorer Experiment


Title: Use CoreText to find macOS fonts by iccir · Pull Request #31977 · matplotlib/matplotlib · GitHub

Open Graph Title: Use CoreText to find macOS fonts by iccir · Pull Request #31977 · matplotlib/matplotlib

X Title: Use CoreText to find macOS fonts by iccir · Pull Request #31977 · matplotlib/matplotlib

Description: Closes #28249 Closes #31965 Why is this change necessary? Prior to this change, findSystemFonts() in font_manager.py called system_profiler -xml SPFontsDataType. This subprocess would load 1000+ font files in order to parse localized names. As we only need font paths, we can instead query CoreText directly. This finishes in ~63ms on my machine instead of ~7 seconds. Differences in found fonts system_profiler uses the private kCTFontCollectionIncludeInvisibleFontsOption option to find "invisible" fonts. These are fonts with names starting with '.'. These fonts are typically unavailable using the standard macOS font APIs. On my machine (macOS 14.8), the following fonts are "invisible": /System/Library/Fonts/ADTNumeric.ttc /System/Library/Fonts/AquaKana.ttc /System/Library/Fonts/HelveLTMM /System/Library/Fonts/Keyboard.ttf /System/Library/Fonts/LastResort.otf /System/Library/Fonts/NewYork.ttf /System/Library/Fonts/NewYorkItalic.ttf /System/Library/Fonts/SFArabic.ttf /System/Library/Fonts/SFArabicRounded.ttf /System/Library/Fonts/SFArmenian.ttf /System/Library/Fonts/SFArmenianRounded.ttf /System/Library/Fonts/SFCamera.ttf /System/Library/Fonts/SFCompact.ttf /System/Library/Fonts/SFCompactItalic.ttf /System/Library/Fonts/SFCompactRounded.ttf /System/Library/Fonts/SFGeorgian.ttf /System/Library/Fonts/SFGeorgianRounded.ttf /System/Library/Fonts/SFHebrew.ttf /System/Library/Fonts/SFHebrewRounded.ttf /System/Library/Fonts/SFNS.ttf /System/Library/Fonts/SFNSItalic.ttf /System/Library/Fonts/SFNSMono.ttf /System/Library/Fonts/SFNSMonoItalic.ttf /System/Library/Fonts/SFNSRounded.ttf /System/Library/Fonts/ThonburiUI.ttc /System/Library/Fonts/TimesLTMM My change uses the CTFontCollectionCreateFromAvailableFonts() without this private option; hence, these fonts will be missing from the list returned by _get_macos_fonts(). However, font_manager.py later re-scans the "/System/Library/Fonts" path, so it should discover these invisible fonts at that time. I tested this change on macOS Mojave (10.14) and macOS Sonoma (14.8). I was unable to test on 10.12 or 10.13 as I updated my 10.12 test device to 10.14. The CoreText API used has been available since 10.5, so I do not foresee any compatibility issues. AI Disclosure The original C-based implementation in #31965 is my own without any usage of AI. I used AI to help me convert it to C++ and return a py::set (my original implementation printed the paths). I used AI to check the resulting files and verify that I was following the correct formatting guidelines. PR checklist "closes #0000" is in the body of the PR description to link the related issue new and changed code is tested [N/A] Plotting related features are demonstrated in an example [N/A] New Features and API Changes are noted with a directive and release note Documentation complies with general and docstring guidelines

Open Graph Description: Closes #28249 Closes #31965 Why is this change necessary? Prior to this change, findSystemFonts() in font_manager.py called system_profiler -xml SPFontsDataType. This subprocess would load 1000+ fo...

X Description: Closes #28249 Closes #31965 Why is this change necessary? Prior to this change, findSystemFonts() in font_manager.py called system_profiler -xml SPFontsDataType. This subprocess would load 1000+ fo...

Opengraph URL: https://github.com/matplotlib/matplotlib/pull/31977

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:c2accf1d-ff5b-4a8b-e9f7-be38f8164843
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9AA0:1FFDFF:63E7E6B:8C43183:6A503F45
html-safe-noncef4c9c8e7c15a40bdc4c727b39d8126e88d2704a76f267c4e0633b31fbd60b7c1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QUEwOjFGRkRGRjo2M0U3RTZCOjhDNDMxODM6NkE1MDNGNDUiLCJ2aXNpdG9yX2lkIjoiMzk0MDc2NzQ0MzczNjA4NDI5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacd8bbff095b597f96f36191d71c30a013037077184e67d2fda5bb848c201b7c41
hovercard-subject-tagpull_request:3973000585
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/matplotlib/matplotlib/pull/31977/files
twitter:imagehttps://avatars.githubusercontent.com/u/1097294?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1097294?s=400&v=4
og:image:altCloses #28249 Closes #31965 Why is this change necessary? Prior to this change, findSystemFonts() in font_manager.py called system_profiler -xml SPFontsDataType. This subprocess would load 1000+ fo...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noned6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
released90666eaf032b7eb8975a378efe38e37f4ebb96c
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/matplotlib/matplotlib/pull/31977/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fpull%2F31977%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fpull%2F31977%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=matplotlib%2Fmatplotlib
Reloadhttps://github.com/matplotlib/matplotlib/pull/31977/files
Reloadhttps://github.com/matplotlib/matplotlib/pull/31977/files
Reloadhttps://github.com/matplotlib/matplotlib/pull/31977/files
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/31977/files
matplotlib https://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/31977/files
Notifications https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Fork 8.4k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Star 23k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Code https://github.com/matplotlib/matplotlib
Issues 1.1k https://github.com/matplotlib/matplotlib/issues
Pull requests 410 https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality 0 https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
Code https://github.com/matplotlib/matplotlib
Issues https://github.com/matplotlib/matplotlib/issues
Pull requests https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fmatplotlib%2Fmatplotlib%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib%2Fissues%2Fnew%2Fchoose
iccirhttps://github.com/iccir
matplotlib:mainhttps://github.com/matplotlib/matplotlib/tree/main
iccir:coretext-find-fontshttps://github.com/iccir/matplotlib/tree/coretext-find-fonts
Conversation 0 https://github.com/matplotlib/matplotlib/pull/31977
Commits 2 https://github.com/matplotlib/matplotlib/pull/31977/commits
Checks 51 https://github.com/matplotlib/matplotlib/pull/31977/checks
Files changed https://github.com/matplotlib/matplotlib/pull/31977/files
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/31977/files
Use CoreText to find macOS fonts https://github.com/matplotlib/matplotlib/pull/31977/files#top
Show all changes 2 commits https://github.com/matplotlib/matplotlib/pull/31977/files
50cbd1e Use CoreText to find macOS fonts iccir Jul 1, 2026 https://github.com/matplotlib/matplotlib/pull/31977/commits/50cbd1e491d625f6f554ee492e7616b930a9183b
aa947c8 Fix mypy-stubtest failure iccir Jul 1, 2026 https://github.com/matplotlib/matplotlib/pull/31977/commits/aa947c8e7a4f36669d0460983b3d94b39747c1ab
Clear filters https://github.com/matplotlib/matplotlib/pull/31977/files
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/31977/files
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/31977/files
_c_internal_utils.pyi https://github.com/matplotlib/matplotlib/pull/31977/files#diff-98f06b87d8ae7193b589b0a050d1a2e202bea6991794c39e53579acb4c51bc8f
font_manager.py https://github.com/matplotlib/matplotlib/pull/31977/files#diff-aca801331b4c856bff720af0575b9ad63f402c893abd7d939e5547ba961ee324
font_manager.pyi https://github.com/matplotlib/matplotlib/pull/31977/files#diff-2d16cf80d819f345b8b708aa383fa6f34e8f1fb3b66da64e8ae38e95f7df84d6
test_font_manager.py https://github.com/matplotlib/matplotlib/pull/31977/files#diff-aca6c193697f6f40146f192e074e201b72dc8633a9bd359d2037dc92f42acf47
_c_internal_utils.cpp https://github.com/matplotlib/matplotlib/pull/31977/files#diff-c67a22a72dcc5a953b1ca9b81dc09538ecbcf18eb929553b5d811e9a3fa923e4
meson.build https://github.com/matplotlib/matplotlib/pull/31977/files#diff-f28598af2e23aa5d2bc7c72e022ae2c56a33802eb970afffaeca1e40607f97fe
lib/matplotlib/_c_internal_utils.pyihttps://github.com/matplotlib/matplotlib/pull/31977/files#diff-98f06b87d8ae7193b589b0a050d1a2e202bea6991794c39e53579acb4c51bc8f
View file https://github.com/matplotlib/matplotlib/blob/aa947c8e7a4f36669d0460983b3d94b39747c1ab/lib/matplotlib/_c_internal_utils.pyi
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/31977/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-98f06b87d8ae7193b589b0a050d1a2e202bea6991794c39e53579acb4c51bc8f
lib/matplotlib/font_manager.pyhttps://github.com/matplotlib/matplotlib/pull/31977/files#diff-aca801331b4c856bff720af0575b9ad63f402c893abd7d939e5547ba961ee324
View file https://github.com/matplotlib/matplotlib/blob/aa947c8e7a4f36669d0460983b3d94b39747c1ab/lib/matplotlib/font_manager.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/31977/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-aca801331b4c856bff720af0575b9ad63f402c893abd7d939e5547ba961ee324
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-aca801331b4c856bff720af0575b9ad63f402c893abd7d939e5547ba961ee324
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-aca801331b4c856bff720af0575b9ad63f402c893abd7d939e5547ba961ee324
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-aca801331b4c856bff720af0575b9ad63f402c893abd7d939e5547ba961ee324
lib/matplotlib/font_manager.pyihttps://github.com/matplotlib/matplotlib/pull/31977/files#diff-2d16cf80d819f345b8b708aa383fa6f34e8f1fb3b66da64e8ae38e95f7df84d6
View file https://github.com/matplotlib/matplotlib/blob/aa947c8e7a4f36669d0460983b3d94b39747c1ab/lib/matplotlib/font_manager.pyi
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/31977/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-2d16cf80d819f345b8b708aa383fa6f34e8f1fb3b66da64e8ae38e95f7df84d6
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-2d16cf80d819f345b8b708aa383fa6f34e8f1fb3b66da64e8ae38e95f7df84d6
lib/matplotlib/tests/test_font_manager.pyhttps://github.com/matplotlib/matplotlib/pull/31977/files#diff-aca6c193697f6f40146f192e074e201b72dc8633a9bd359d2037dc92f42acf47
View file https://github.com/matplotlib/matplotlib/blob/aa947c8e7a4f36669d0460983b3d94b39747c1ab/lib/matplotlib/tests/test_font_manager.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/31977/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-aca6c193697f6f40146f192e074e201b72dc8633a9bd359d2037dc92f42acf47
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-aca6c193697f6f40146f192e074e201b72dc8633a9bd359d2037dc92f42acf47
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-aca6c193697f6f40146f192e074e201b72dc8633a9bd359d2037dc92f42acf47
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-aca6c193697f6f40146f192e074e201b72dc8633a9bd359d2037dc92f42acf47
src/_c_internal_utils.cpphttps://github.com/matplotlib/matplotlib/pull/31977/files#diff-c67a22a72dcc5a953b1ca9b81dc09538ecbcf18eb929553b5d811e9a3fa923e4
View file https://github.com/matplotlib/matplotlib/blob/aa947c8e7a4f36669d0460983b3d94b39747c1ab/src/_c_internal_utils.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/31977/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-c67a22a72dcc5a953b1ca9b81dc09538ecbcf18eb929553b5d811e9a3fa923e4
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-c67a22a72dcc5a953b1ca9b81dc09538ecbcf18eb929553b5d811e9a3fa923e4
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-c67a22a72dcc5a953b1ca9b81dc09538ecbcf18eb929553b5d811e9a3fa923e4
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-c67a22a72dcc5a953b1ca9b81dc09538ecbcf18eb929553b5d811e9a3fa923e4
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-c67a22a72dcc5a953b1ca9b81dc09538ecbcf18eb929553b5d811e9a3fa923e4
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-c67a22a72dcc5a953b1ca9b81dc09538ecbcf18eb929553b5d811e9a3fa923e4
src/meson.buildhttps://github.com/matplotlib/matplotlib/pull/31977/files#diff-f28598af2e23aa5d2bc7c72e022ae2c56a33802eb970afffaeca1e40607f97fe
View file https://github.com/matplotlib/matplotlib/blob/aa947c8e7a4f36669d0460983b3d94b39747c1ab/src/meson.build
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/31977/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-f28598af2e23aa5d2bc7c72e022ae2c56a33802eb970afffaeca1e40607f97fe
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-f28598af2e23aa5d2bc7c72e022ae2c56a33802eb970afffaeca1e40607f97fe
https://github.com/matplotlib/matplotlib/pull/31977/files#diff-f28598af2e23aa5d2bc7c72e022ae2c56a33802eb970afffaeca1e40607f97fe
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/31977/files
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

Viewport: width=device-width


URLs of crawlers that visited me.