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

Update font_manager to only use registry on Win #24655

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

almarklein
Copy link
Contributor

@almarklein almarklein commented Dec 7, 2022

anntzer
anntzer previously approved these changes Dec 7, 2022
@tacaswell
Copy link
Member

tacaswell commented Dec 7, 2022

xref to #24001

@anntzer anntzer requested review from anntzer and removed request for anntzer Dec 7, 2022
@anntzer anntzer dismissed their stale review Dec 7, 2022

Actually, a test needs to be updated too.

@anntzer anntzer added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Dec 15, 2022
@anntzer
Copy link
Contributor

anntzer commented Dec 15, 2022

I think that this or something similar needs to make it into 3.7 to fix #24641 being partially incorrect; or #24641 needs to be temporarily reverted for 3.7.

@anntzer anntzer added this to the v3.7.0 milestone Dec 15, 2022
@tacaswell
Copy link
Member

tacaswell commented Dec 16, 2022

____________________________ test_user_fonts_win32 ____________________________
[gw1] win32 -- Python 3.10.8 C:\hostedtoolcache\windows\Python\3.10.8\x64\python.exe

    @pytest.mark.skipif(sys.platform != 'win32', reason='Windows only')
    def test_user_fonts_win32():
        if not (os.environ.get('APPVEYOR') or os.environ.get('TF_BUILD')):
            pytest.xfail("This test should only run on CI (appveyor or azure) "
                         "as the developer's font directory should remain "
                         "unchanged.")
    
        font_test_file = 'mpltest.ttf'
    
        # Precondition: the test font should not be available
        fonts = findSystemFonts()
        if any(font_test_file in font for font in fonts):
            pytest.skip(f'{font_test_file} already exists in system fonts')
    
        user_fonts_dir = MSUserFontDirectories[0]
    
        # Make sure that the user font directory exists (this is probably not the
        # case on Windows versions < 1809)
        os.makedirs(user_fonts_dir)
    
        # Copy the test font to the user font directory
        shutil.copy(Path(__file__).parent / font_test_file, user_fonts_dir)
    
        # Now, the font should be available
        fonts = findSystemFonts()
>       assert any(font_test_file in font for font in fonts)
E       assert False
E        +  where False = any(<generator object test_user_fonts_win32.<locals>.<genexpr> at 0x000002364CB2A8F0>)

https://dev.azure.com/matplotlib/matplotlib/_build/results?buildId=30184&view=logs&j=595c9a33-3ac5-58f0-6ce6-44c63ffdfe86&t=6405dc77-f20a-51d5-22e4-a611ccc41f2e&l=182

The failure is definitely caused by this change

lib/matplotlib/font_manager.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. status: needs revision
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: findSystemFonts should not look in subdirectories of C:\Windows\Fonts\
4 participants