Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Query macOS for available system fonts.#27230

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
dstansby merged 1 commit intomatplotlib:mainfromanntzer:macosfonts
Jan 12, 2024

Conversation

anntzer
Copy link
Contributor

@anntzeranntzer commentedOct 30, 2023
edited
Loading

... instead of only relying on a fixed list of directories to check. Note that both previously and with this PR, we continue also querying fontconfig.

See#10932. This should close the original issue (#10201); for#10932 I would suggest further dropping out the extra hard-coded directories (X11FontDirectories, OSXFontDirectories) that are searched.

PR summary

PR checklist

... instead of only relying on a fixed list of directories to check.Note that both previously and with this PR, we continue also queryingfontconfig.
@ksunden
Copy link
Member

I did not realize thatplistlib was in the std library...

@QuLogicQuLogic added this to thev3.9.0 milestoneOct 31, 2023
def _get_macos_fonts():
"""Cache and list the font paths known to ``system_profiler SPFontsDataType``."""
d, = plistlib.loads(
subprocess.check_output(["system_profiler", "-xml", "SPFontsDataType"]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Is this output portable across different system languages?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

From a quick check, the answer appears to be yes.

Copy link
Contributor

@greglucasgreglucas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'll note thatsystem_profiler -xml SPFontsDataType is quite a bit slower thanfc-list for me. This does work as expected and is only adding extra time to the initial cache build.

Copy link
Member

@dstansbydstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM; doesn't take that long to build the font cache on this PR for me (~seconds on an M2 MacBook Air), and more fonts are found (374 before, 497 after)

@dstansbydstansby merged commit18bfd1e intomatplotlib:mainJan 12, 2024
@anntzeranntzer deleted the macosfonts branchJanuary 12, 2024 21:07
@denis-bz
Copy link

@anntzer, on my macos 10.15.7 Catalina

system_profiler -xml SPFontsDataType  2>&1    # <- def _get_macos_fonts() in mpl 3.9.0

💥

2024-05-17 11:56:24.964 system_profiler[1061:15889] CoreText note: Client requested name ".AlBayanPUA", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].2024-05-17 11:56:24.964 system_profiler[1061:15889] CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.2024-05-17 11:56:24.968 system_profiler[1061:15889] CoreText note: Client requested name ".AlBayanPUA-Bold", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].2024-05-17 11:56:24.972 system_profiler[1061:15889] CoreText note: Client requested name ".AlNilePUA", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].2024-05-17 11:56:24.975 system_profiler[1061:15889] CoreText note: Client requested name ".AlNilePUA-Bold", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].2024-05-17 11:56:24.978 system_profiler[1061:15889] CoreText note: Client requested name ".AlTarikhPUA", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].2024-05-17 11:56:24.982 system_profiler[1061:15889] CoreText note: Client requested name ".AppleColorEmojiUI", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].2024-05-17 11:56:24.985 system_profiler[1061:15889] CoreText note: Client requested name ".AppleSDGothicNeoI-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].2024-05-17 11:56:24.988 system_profiler[1061:15889] CoreText note: Client requested name ".AppleSDGothicNeoI-Medium", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].2024-05-17 11:56:24.991 system_profiler[1061:15889] CoreText note: Client requested name ".AppleSDGothicNeoI-Light", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:]....

200-odd such lines.
So I reinstalled matplotlib==3.8.4.
Please advise: are there functions in font_manager.py I can call to help debug this
or caches / .jsons I can delete ? Thanks

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic left review comments

@dstansbydstansbydstansby approved these changes

@greglucasgreglucasgreglucas approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.9.0
Development

Successfully merging this pull request may close these issues.

6 participants
@anntzer@ksunden@denis-bz@QuLogic@dstansby@greglucas

[8]ページ先頭

©2009-2025 Movatter.jp