mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
For bug 65437. Add param --use-system-user-fonts to allfontsgen
This commit is contained in:
@ -1707,7 +1707,7 @@ static long GetNextNameValue(HKEY key, const std::wstring& sSubkey, std::wstring
|
||||
|
||||
#endif
|
||||
|
||||
std::vector<std::wstring> CApplicationFonts::GetSetupFontFiles()
|
||||
std::vector<std::wstring> CApplicationFonts::GetSetupFontFiles(const bool& bIsUseUserFonts)
|
||||
{
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
// Ищем директорию с фонтами (обычно это C:\Windows\Fonts)
|
||||
@ -1778,13 +1778,16 @@ std::vector<std::wstring> CApplicationFonts::GetSetupFontFiles()
|
||||
{
|
||||
std::vector<std::wstring> oArray2 = NSDirectory::GetFiles(L"C:\\Windows\\Fonts", true);
|
||||
|
||||
wchar_t sUserName[1000];
|
||||
DWORD nUserNameLen = 1000 + 1;
|
||||
GetUserNameW(sUserName, &nUserNameLen);
|
||||
std::wstring strUserName(sUserName, nUserNameLen - 1);
|
||||
if (bIsUseUserFonts)
|
||||
{
|
||||
wchar_t sUserName[1000];
|
||||
DWORD nUserNameLen = 1000 + 1;
|
||||
GetUserNameW(sUserName, &nUserNameLen);
|
||||
std::wstring strUserName(sUserName, nUserNameLen - 1);
|
||||
|
||||
NSDirectory::GetFiles2(L"C:\\Users\\" + strUserName + L"\\AppData\\Local\\Microsoft\\Windows\\Fonts", oArray2, false);
|
||||
NSDirectory::GetFiles2(L"C:\\Users\\" + strUserName + L"\\AppData\\Local\\Microsoft\\FontCache\\4\\CloudFonts", oArray2, true);
|
||||
NSDirectory::GetFiles2(L"C:\\Users\\" + strUserName + L"\\AppData\\Local\\Microsoft\\Windows\\Fonts", oArray2, false);
|
||||
NSDirectory::GetFiles2(L"C:\\Users\\" + strUserName + L"\\AppData\\Local\\Microsoft\\FontCache\\4\\CloudFonts", oArray2, true);
|
||||
}
|
||||
|
||||
for (std::vector<std::wstring>::iterator i = oArray2.begin(); i != oArray2.end(); i++)
|
||||
{
|
||||
@ -1800,9 +1803,11 @@ std::vector<std::wstring> CApplicationFonts::GetSetupFontFiles()
|
||||
std::vector<std::wstring> _array = NSDirectory::GetFiles(L"/usr/share/fonts", true);
|
||||
NSDirectory::GetFiles2(L"/usr/share/X11/fonts", _array, true);
|
||||
NSDirectory::GetFiles2(L"/usr/X11R6/lib/X11/fonts", _array, true);
|
||||
NSDirectory::GetFiles2(L"/usr/local/share/fonts", _array, true);
|
||||
NSDirectory::GetFiles2(L"/run/host/fonts", _array, true);
|
||||
|
||||
if (bIsUseUserFonts)
|
||||
NSDirectory::GetFiles2(L"/usr/local/share/fonts", _array, true);
|
||||
|
||||
#ifndef BUILDING_WASM_MODULE
|
||||
std::wstring custom_fonts_path = NSSystemUtils::GetEnvVariable(L"CUSTOM_FONTS_PATH");
|
||||
if (!custom_fonts_path.empty())
|
||||
|
||||
@ -345,7 +345,7 @@ public:
|
||||
void InitializeFromBin(BYTE* pData, unsigned int nLen);
|
||||
void InitializeRanges(unsigned char* data);
|
||||
|
||||
std::vector<std::wstring> GetSetupFontFiles();
|
||||
std::vector<std::wstring> GetSetupFontFiles(const bool& bIsUseUserFonts = true);
|
||||
void InitializeFromArrayFiles(std::vector<std::wstring>& files, int nFlag = 0);
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
|
||||
@ -1566,6 +1566,7 @@ public:
|
||||
CApplicationFontsWorker::CApplicationFontsWorker()
|
||||
{
|
||||
m_bIsUseSystemFonts = true;
|
||||
m_bIsUseSystemUserFonts = true;
|
||||
m_bIsNeedThumbnails = true;
|
||||
m_bIsUseOpenType = true;
|
||||
m_bIsUseAllVersions = false;
|
||||
@ -1658,7 +1659,7 @@ NSFonts::IApplicationFonts* CApplicationFontsWorker::Check()
|
||||
std::vector<std::wstring> strFontsW_Cur;
|
||||
|
||||
if (m_bIsUseSystemFonts)
|
||||
strFontsW_CurSrc = pApplicationF->GetSetupFontFiles();
|
||||
strFontsW_CurSrc = pApplicationF->GetSetupFontFiles(m_bIsUseSystemUserFonts);
|
||||
|
||||
for (std::vector<std::wstring>::iterator i = m_arAdditionalFolders.begin(); i != m_arAdditionalFolders.end(); i++)
|
||||
{
|
||||
|
||||
@ -51,6 +51,8 @@ class GRAPHICS_DECL CApplicationFontsWorker
|
||||
public:
|
||||
// использовать ли системные шрифты
|
||||
bool m_bIsUseSystemFonts;
|
||||
bool m_bIsUseSystemUserFonts;
|
||||
|
||||
// дополнительные папки с шрифтами
|
||||
std::vector<std::wstring> m_arAdditionalFolders;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user