Additional Windows 10 font directory location (v 1809)

Bug #1888798 reported by John Card II
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Unassigned

Bug Description

calibre v4.21, Windows 10 Pro, version 1903, OS build 18362.959

Calibre util font scanner on Windows looks in the system fonts directory for fonts. This is where fonts go when a user chooses "Install for all users". If, instead, one chooses to just "install" a font, windows will now (as of version 1809) place the file in "%LOCALAPPDATA%\Microsoft\Windows\Fonts" (which is also "%USERPROFILE%\AppData\Local\Microsoft\Windows\Fonts"). Thus, newly installed fonts are not placed in the CALIBRE_CONFIG_DIRECTORY/fonts/scanner_cache.json file (I am fairly sure this is the correct root for the scanner_cache.json file). Please note that the drop down lists of fonts generated for "preferences - conversion - output options - pdf output" DOES include fonts from both system and LOCALAPPDATA font lists, these are supported by QFontComboBox and QFontDatabase. This affects plugins that use the calibre implemented font scanner cache.

Steps to replicate, and a workaround:

Find a new font file for Windows 10 (1809)

calibre plugin installed that uses font scanner cache, e.g. "Generate Cover"
calibre not running
Delete the curent scanner_cache.json file to cause it to be rebuilt

Open Windows fonts directory (winkey-R "shell:fonts" is one way)
Confirm that new font is not installed
Right click new font file and choose "Install" from the menu, NOT "Install for all users"
Confirm that new font is "in" windows fonts directory, but right-click properties on font shows location is actually "%LOCALAPPDATA%\Microsoft\Windows\Fonts"

Start calibre
Confirm scanner_cache.json is created
Confirm new font not in scanner_cache.json
Confirm font not available to "Generate Cover"
Stop calibre
Delete the scanner_cache.json file
Uninstall (delete) font from windows font tool
re-install font and this time choose "Install for all users"
Confirm that new font is "in" windows fonts directory and right-click properties shows location is, e.g. "C:\Windows\Fonts"
Start Calibre
Confirm scanner_cache.json is created
Confirm new font in scanner_cache.json
Confirm font now available to "Generate Cover"

??? Possible fix for this bug:
If a windows user has an library named "fontconfig", I don't think the below will work, but maybe add "os.path.expanduser('~/AppData/Local/Microsoft/Windows/Fonts')" as additional value returned from "def default_font_dirs():" around line 30 in "src/calibre/utils/fonts/scanner.py"

See also discussions:
https://thewincentral.com/windows-10-redstone-5-version-1809-all-changes-new-features-so-far-categorized-changelog/ (search for "Font")

how inkscape resolved issue in their code at https://gitlab.com/inkscape/inkscape/-/issues/50
And matplotlib at https://github.com/matplotlib/matplotlib/issues/12954/

Revision history for this message
John Card II (jcii) wrote :

I found this bug when I began to use the "Generate Cover" plugin to create custom covers for documents that I've stored in calibre. I decided to install some new fonts to use for generated covers, and could not find my new fonts in the list managed by the plugin. About 2 hours of research led to this bug report.

Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in master

Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.

 status fixreleased

Changed in calibre:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.