Don't log AddFontResourceEx() errors with wxLogSysError()

According to AddFontResourceEx documentation[1], there is no extended error
information available on failure, so any error logged by wxLogSysError()
is unrelated to the call.

In my experience, the sys error that was logged on failure (e.g.
corrupted/unsupported but existing font file) was ERROR_FILE_NOT_FOUND,
but the same error would be logged after a successful call also.

[1] https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-addfontresourceexw

Closes https://github.com/wxWidgets/wxWidgets/pull/2630
This commit is contained in:
Lauri Nurmi 2021-12-28 14:52:54 +02:00 committed by Vadim Zeitlin
parent 8085ba9156
commit 584282800e

View File

@ -1123,7 +1123,7 @@ bool wxFontBase::AddPrivateFont(const wxString& filename)
{
if ( !AddFontResourceEx(filename.t_str(), FR_PRIVATE, 0) )
{
wxLogSysError(_("Font file \"%s\" couldn't be loaded"), filename);
wxLogError(_("Font file \"%s\" couldn't be loaded"), filename);
return false;
}