Skip to content
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

font finding in OSX produces 200+ lines of warnings #28249

Open
tacaswell opened this issue May 17, 2024 · 5 comments
Open

font finding in OSX produces 200+ lines of warnings #28249

tacaswell opened this issue May 17, 2024 · 5 comments
Milestone

Comments

@tacaswell
Copy link
Member

          @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

Originally posted by @denis-bz in #27230 (comment)

@tacaswell tacaswell added this to the v3.9.1 milestone May 17, 2024
@denis-bz
Copy link

denis-bz commented May 17, 2024

Should the title be "font finding in OSX 10.15 ..." ?
MacOS_version_history says it's an "old version", not even "Older version, still maintained".
(Is there info on macos-versions-tested someplace ? Oughta be in METADATA.)

@tacaswell
Copy link
Member Author

Do we know it is osx version specific?

@jklymak
Copy link
Member

jklymak commented May 17, 2024

This does not happen for 14.x (Sonoma). Catalina is quite old - not sure when the difference would have come in.

@denis-bz
Copy link

denis-bz commented May 18, 2024

edit Sunday 19 May:
Folks,
until this is reproduced on other Macos versions, I'd drop it to low low priority --
better things to do than try to decipher these murky error messages (I got nowhere).
A workaround that works for me is to just ignore stderr in
font_manager.py _get_macos_fonts, instead of check_output --

@lru_cache
def _get_macos_fonts():
    p = subprocess.Popen( "system_profiler -xml SPFontsDataType" .split(),
            stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=False )
    d, = plistlib.loads( p.stdout.read() )  # not load( p.stdout )    
    items = [Path(entry["path"]) for entry in d["_items"]]
    # print( "▄ bp _get_macos_fonts", len(items) );  breakpoint()
    return items

@anntzer
Copy link
Contributor

anntzer commented May 20, 2024

Unfortunately I can't repro this on any of the macos versions present on GHA (which start at macos11). I suspect that the practical solution is indeed to silently ignore errors from system_profiler, at least when stdout is valid xml (i.e. we can assume that we'll still get a useful list of fonts from it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants