Skip to content

Commit

Permalink
[src\font_file_lister_gdi] Replace WCHAR by std::wstring
Browse files Browse the repository at this point in the history
  • Loading branch information
moi15moi authored and 0tkl committed Mar 8, 2024
1 parent 4f43db3 commit 2799f2e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/font_file_lister_gdi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ CollectionResult GdiFontFileLister::GetFontPaths(std::string const& facename, in
if (FAILED(local_loader_sh->GetFilePathLengthFromKey(font_file_reference_key, font_file_reference_key_size, &path_length)))
return ret;

WCHAR* path = new WCHAR[path_length + 1];
if (FAILED(local_loader_sh->GetFilePathFromKey(font_file_reference_key, font_file_reference_key_size, path, path_length + 1)))
std::wstring path(path_length, L'\0');
if (FAILED(local_loader_sh->GetFilePathFromKey(font_file_reference_key, font_file_reference_key_size, &path[0], path_length + 1)))
return ret;

// DirectWrite always return the file path in upper case. Ex: "C:\WINDOWS\FONTS\ARIAL.TTF"
std::wstring normalized_path = normalizeFilePathCase(std::wstring(path));
std::wstring normalized_path = normalizeFilePathCase(path);
if (normalized_path.empty())
return ret;

Expand Down

0 comments on commit 2799f2e

Please sign in to comment.