5ba6d469
by Dmitry Timoshkov at 2026-02-24T19:48:16+01:00
win32u: When looking for duplicates in the external fonts list don't count not external fonts.
When there's a duplicate font
[Software\\Microsoft\\Windows\\CurrentVersion\\Fonts]
"Courier New (TrueType)"="C:\\windows\\Fonts\\COUR.TTF"
and
[Software\\Wine\\Fonts\\External Fonts]
"Courier New (TrueType)"="Z:\\usr\\share\\fonts\\ttf\\ms\\cour.ttf"
and the face list has "Courier New" as C:\\windows\\Fonts\\COUR.TTF
then 'wcsicmp( face->file, path )' doesn't catch this case and the font
will be removed from the registry but won't be added back because
the loaded font face doesn't have ADDFONT_EXTERNAL_FONT flag set.
This is a real case that happened with the application installer that
installs "Courier New" fonts family apparently without checking actual
presence of the font with EnumFonts().
Steps to reproduce:
1. apt-get install fonts-ttf-ms
2. winetricks -q courier
3. Both of the above mentioned registry keys must exist:
cat > HKLM_Fonts.reg << EOF
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Fonts]
"Courier New (TrueType)"="C:\\windows\\Fonts\\COUR.TTF"
EOF
wine regedit HKLM_Fonts.reg
cat > HKCU_External_Fonts.reg << EOF
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Fonts\External Fonts]
"Courier New (TrueType)"="Z:\\usr\\share\\fonts\\ttf\\ms\\cour.ttf"
EOF
wine regedit HKCU_External_Fonts.reg
4. Run 'wine blah' (it's not necessary to run a real application), and
check the listed above registry keys, "Courier New (TrueType)" key is gone.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>