Skip to content

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

Closed

Description

@tacaswell
          @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)

Activity

  1. added this to the v3.9.1 milestone on May 17, 2024
  2. denis-bz commented on May 17, 2024

    @denis-bz

    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.

    Added: https://endoflife.date/macos https://endoflife.date/python ... give a little more info;
    ahhh, planned obsolescence ...

  3. tacaswell commented on May 17, 2024

    @tacaswell
    MemberAuthor

    Do we know it is osx version specific?

  4. jklymak commented on May 17, 2024

    @jklymak
    Member

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

  5. denis-bz commented on May 18, 2024

    @denis-bz

    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
    
  6. anntzer commented on May 20, 2024

    @anntzer
    Contributor

    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).

  7. modified the milestones: v3.9.1, v3.9.2 on Jul 4, 2024
  8. modified the milestones: v3.9.2, v3.9.3 on Aug 12, 2024
  9. modified the milestones: v3.9.3, v3.10.1 on Nov 30, 2024
  10. modified the milestones: v3.10.1, v3.10.2 on Feb 21, 2025
  11. removed this from the v3.10.2 milestone on May 2, 2025
  12. 1 remaining item

  13. modified the milestones: v3.10.4, v3.11.0 on Jul 24, 2025
  14. modified the milestones: v3.11.0, v3.11.1 on Jun 9, 2026
  15. denis-bz commented on Jun 12, 2026

    @denis-bz

    @tacaswell, folks,
    pip install matplotlib to 3.11.0 seems to have hidden SPFontsDataType
    so that system_profiler -xml SPFontsDataType spits out 200 lines of warnings like the above
    (which I don't understand).
    Worse, back to pip install matplotlib==3.10.9 doesn't help;
    rm -r ~/Library/Caches doesn't help. Can a macos-font expert help me ?

    _get_macos_fonts in the two font_manager.py look the same.

    (This is on the same old mac 10.15, which I realize is endoflife ...)
    Thanks, cheers

  16. iccir commented on Jun 27, 2026

    @iccir
    Contributor

    @denis-bz - To be clear, if you run system_profile in Terminal on the 10.15 machine, you are getting the 200 lines of warnings? If so, the problem is internal to the system_profile utility and is something that Apple fixed in macOS 11 and later.

    This message originates from TDescriptorSource::CopyFontDescriptorPerPostScriptName in the CoreText framework. If TDescriptorSource::ShouldSubstituteInvisibleFontName returns true, CTFontLogSystemFontNameRequest() is called and the logs print. There's a flag that suppresses this behavior, which is likely what Apple started using on macOS 11 to prevent the output.

    For 10.15, I don't think there's anything that can be done other than filter out lines with "CoreText note" from stderr.

  17. iccir commented on Jun 27, 2026

    @iccir
    Contributor

    After installing macOS 10.15 Catalina and reversing the CoreText, SPFontReporter, and UIFoundation binaries, I don't think that there's any way to avoid this error. The only way is to filter out the lines that contain "CoreText note".

    In 10.15, -[SPFontReporter infoForDescriptor:] always calls +[NSFont fontWithName:size:], which will always print this log message by design.

    In 11.0, Apple added a check to see if the font is private (starts with a .). If true, they no longer call into +[NSFont fontWithName:size:].

    Binary Ninja output from 11.0's SPFontReporter binary Image
  18. denis-bz commented on Jul 2, 2026

    @denis-bz

    @iccir, thanks for going through these twisty passages; IOU a beverage of your choice 🍺

  19. modified the milestones: v3.11.1, v3.11.2 on Jul 17, 2026
  20. modified the milestones: v3.11.2, v3.12.0 on Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions