Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Update font_manager to only use registry on Win#24655
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
xref to#24001 |
The failure is definitely caused by this change |
Uh oh!
There was an error while loading.Please reload this page.
story645 left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
both loops return the same fonts1 with extensions[".afm", ".ttf", ".otf", ".ttc" ]
and the hkey points toC:\WINDOWS\Fonts
ETA: I'm now confused how that test failed since both of the keys in the fontpath are in the windows installed search function, unless it's a permissions thing?
matplotlib/lib/matplotlib/font_manager.py
Lines 223 to 226 in65e54af
fordomain,base_dirsin [ | |
(winreg.HKEY_LOCAL_MACHINE, [win32FontDirectory()]),# System. | |
(winreg.HKEY_CURRENT_USER,MSUserFontDirectories),# User. | |
]: |
Footnotes
the old loop returns
{'', '.CompositeFont', '.TTF', '.dat', '.fon', '.ini', '.ttc', '.ttf', '.xml'}
because there's no extension filtering.↩
story645 commentedDec 30, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Also, I dunno if this is sensible but I modified the test to run it on my local machine, and I'm now getting the same failure, w/ the same message: @pytest.mark.skipif(sys.platform!='win32',reason='Windows only')deftest_user_fonts_win32():font_test_file='mpltest.ttf'# Precondition: the test font should not be availablefonts=findSystemFonts()ifany(font_test_fileinfontforfontinfonts):pytest.skip(f'{font_test_file} already exists in system fonts')user_fonts_dir=Path(MSUserFontDirectories[0])# Make sure that the user font directory exists (this is probably not the# case on Windows versions < 1809)user_fonts_dir.mkdir(exist_ok=True)# Copy the test font to the user font directoryshutil.copy(Path(__file__).parent/font_test_file,user_fonts_dir)assert (user_fonts_dir/font_test_file).exists()# Now, the font should be availablefonts=findSystemFonts()assertany(font_test_fileinfontforfontinfonts) (Path(user_fonts_dir)/font_test_file).unlink()assertnot (Path(user_fonts_dir)/font_test_file).exists() ETA: if this is sensible, then I'll wrap up "temp copy" in a context manager. ETA2: I have no idea why the test is failing b/c the directory for writing the tempfile is identical when fontpaths is set or when it's empty
while this is flipped:
and I checked and yeah the file is in AppData |
Ah, are you saying the test is wrong? I think we maybe should be calling |
No, just that I'm not sure why I can't run it locally if I create and clean-up the file during the test? |
I guess what I would like to confirm is; if you use Explorer to copy a new font there, does it get added to the registry? Does it only do so if you use the Install button on the font viewer? What about if you have a Python script that copies the font there; does the registry update automatically, or do you have to open the directory in Explorer to refresh it, or does nothing update the registry? |
story645 commentedJan 4, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
No
Yup
nope
that doesn't seem to work either ETA: as far as I can tell, that test works because it's checking if a file put into a folder is found in the folder, completely bypassing the registry. |
Per discussion on this weeks dev call:
|
1. we are moving to registry only for finding fonts on windows2. our test just drops the font in the correct directory3. this is not enough to get the registry to agree it is thereWe will xfail this test for now.
per need for changes as discussed on the call.
tacaswell left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
but I wrote the behavior change note so this review should be taken with a grain of salt.
@story645 Can you please confirm that this works as expected for fonts installed as Windows expects and merge if you are satisfied? |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
heads up that I won't be able to get to this til tomorrow night/sunday |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
tiny what's new nit. I don't think the failing tests are related to this PR, but I'm not comfortable merging while so many tests are failing.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>Co-authored-by: hannah <story645@gmail.com>
…655-on-v3.7.xBackport PR#24655 on branch v3.7.x (Update font_manager to only use registry on Win)
Uh oh!
There was an error while loading.Please reload this page.
list_fonts
on Windows.