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

Fonts installed in the user directory are not detected (Windows 1809) #12954

Milania1 opened this Issue Dec 9, 2018 · 1 comment


None yet
3 participants
Copy link

Milania1 commented Dec 9, 2018

Starting with Windows 1809, it is now possible to install fonts in the user directory (search for "Font") without the requirement of having administration privileges. These fonts are currently not detected by matplotlib. The main problem is that fonts may be installed accidentally to the user folder and then it is not clear why matplotlib does not detect them (this was the case for me as I din't realize that I installed the font in the user directory).

For anyone facing this issue: a quick workaround is to install the font for all users, i.e. right click and then "Install for all users".

The user fonts are installed in the directory %userprofile%\AppData\Local\Microsoft\Windows\Fonts and there are also registry keys in HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Fonts. The nice thing is that these registry keys also contain (at least on my system) the absolute path to the font files. This is not the case for the system-wide font files.

The function findSystemFonts() seems to be responsible to find all fonts on the system and as far as I can tell, it uses two approaches

  • Collect all fonts which are installed on the system via the registry.
  • Collect all fonts stored in the directory obtained via win32FontDirectory(). In most of the cases, this probably leads to the Windows font directory (C:\Windows\Fonts).

Hence, my approach to fix this issue would also be in two steps:

  • Iterate over the user font registry keys in win32InstalledFonts(). Since the absolute path is stored in the registry, no additional directory information is required here. Alternatively, a new function win32InstalledUserFonts() may be more appropriate (any thoughts?).
  • Additionally, I would add the user font directory to the fontpaths list in findSystemFonts().

This should detect all user fonts.

If this strategy sounds reasonable to you, I can give it a try :-)

Matplotlib version

  • Operating system: Windows x64 1809
  • Matplotlib version: 3.0.2
  • Python version: 3.6.7

This comment has been minimized.

Copy link

anntzer commented Dec 9, 2018

Looks like a reasonable approach to me, go for it.

Milania1 pushed a commit to Milania1/matplotlib that referenced this issue Dec 9, 2018

Milania1 pushed a commit to Milania1/matplotlib that referenced this issue Dec 9, 2018

Milania1 pushed a commit to Milania1/matplotlib that referenced this issue Jan 13, 2019

anntzer added a commit that referenced this issue Jan 13, 2019

Merge pull request #12957 from Milania1/win-user-fonts
Search also for user fonts on Windows (#12954)

@QuLogic QuLogic added this to the v3.1 milestone Jan 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.