Update python.cpp

This commit is contained in:
恍兮惚兮 2024-03-13 11:30:21 +08:00
parent 1af117fea5
commit f9c203a816

View File

@ -84,16 +84,13 @@ std::unordered_map<std::wstring, std::wstring> loadfontfiles() {
auto lpLogfonts = std::make_unique<LOGFONTW[]>(dwFontsLoaded); auto lpLogfonts = std::make_unique<LOGFONTW[]>(dwFontsLoaded);
DWORD cbBuffer = dwFontsLoaded * sizeof(LOGFONTW); DWORD cbBuffer = dwFontsLoaded * sizeof(LOGFONTW);
if (!GetFontResourceInfo(fontfile.c_str(), &cbBuffer, lpLogfonts.get(), QFR_LOGFONT)) { auto succ=GetFontResourceInfo(fontfile.c_str(), &cbBuffer, lpLogfonts.get(), QFR_LOGFONT);
RemoveFontResourceExW(fontfile.c_str(), FR_PRIVATE, 0); RemoveFontResourceExW(fontfile.c_str(), FR_PRIVATE, 0);
continue; if (!succ)continue;
}
for (int k = 0; k < dwFontsLoaded; k++) for (int k = 0; k < dwFontsLoaded; k++)
fntss[i].insert(std::make_pair(lpLogfonts[k].lfFaceName, fontfile)); fntss[i].insert(std::make_pair(lpLogfonts[k].lfFaceName, fontfile));
RemoveFontResourceExW(fontfile.c_str(), FR_PRIVATE, 0);
} }
}; };
for (int i = 0; i < LOADFONTTHREADNUM; i++) { for (int i = 0; i < LOADFONTTHREADNUM; i++) {
ts.emplace_back(std::thread(singletask,i)); ts.emplace_back(std::thread(singletask,i));
} }