Fix "unexpected end of TTF file" error

Changed returnv vector size to 3 by default and set size 5 for WIN32
only.
This commit is contained in:
Andrey Shustov 2024-01-11 07:02:23 +03:00 committed by Christoph Oelckers
parent 64096658e5
commit 0aa140194d

View file

@ -54,7 +54,7 @@ std::vector<SingleFontData> LoadWidgetFontData(const std::string& name)
std::vector<SingleFontData> returnv; std::vector<SingleFontData> returnv;
if (!stricmp(name.c_str(), "notosans")) if (!stricmp(name.c_str(), "notosans"))
{ {
returnv.resize(5); returnv.resize(3);
returnv[0].fontdata = LoadFile("widgets/noto/notosans-regular.ttf"); returnv[0].fontdata = LoadFile("widgets/noto/notosans-regular.ttf");
returnv[1].fontdata = LoadFile("widgets/noto/notosansarmenian-regular.ttf"); returnv[1].fontdata = LoadFile("widgets/noto/notosansarmenian-regular.ttf");
returnv[2].fontdata = LoadFile("widgets/noto/notosansgeorgian-regular.ttf"); returnv[2].fontdata = LoadFile("widgets/noto/notosansgeorgian-regular.ttf");
@ -62,6 +62,7 @@ std::vector<SingleFontData> LoadWidgetFontData(const std::string& name)
wchar_t wbuffer[256]; wchar_t wbuffer[256];
if (GetWindowsDirectoryW(wbuffer, 256)) if (GetWindowsDirectoryW(wbuffer, 256))
{ {
returnv.resize(5);
FString windir(wbuffer); FString windir(wbuffer);
returnv[3].fontdata = LoadDiskFile((windir + "/fonts/yugothm.ttc").GetChars()); returnv[3].fontdata = LoadDiskFile((windir + "/fonts/yugothm.ttc").GetChars());
returnv[3].language = "ja"; returnv[3].language = "ja";