MCPcopy Create free account
hub / github.com/ZDoom/Raze / LoadWidgetFontData

Function LoadWidgetFontData

source/common/widgets/widgetresourcedata.cpp:53–84  ·  view source on GitHub ↗

This interface will later require some significant redesign.

Source from the content-addressed store, hash-verified

51
52// This interface will later require some significant redesign.
53std::vector<SingleFontData> LoadWidgetFontData(const std::string& name)
54{
55 std::vector<SingleFontData> returnv;
56 if (!stricmp(name.c_str(), "notosans"))
57 {
58 returnv.resize(3);
59 returnv[0].fontdata = LoadFile("widgets/noto/notosans-regular.ttf");
60 returnv[1].fontdata = LoadFile("widgets/noto/notosansarmenian-regular.ttf");
61 returnv[2].fontdata = LoadFile("widgets/noto/notosansgeorgian-regular.ttf");
62#ifdef _WIN32
63 wchar_t wbuffer[256];
64 if (GetWindowsDirectoryW(wbuffer, 256))
65 {
66 returnv.resize(5);
67 FString windir(wbuffer);
68 returnv[3].fontdata = LoadDiskFile((windir + "/fonts/yugothm.ttc").GetChars());
69 returnv[3].language = "ja";
70 returnv[4].fontdata = LoadDiskFile((windir + "/fonts/malgun.ttf").GetChars());
71 returnv[4].language = "ko";
72 // Don't fail if these cannot be found
73 if (returnv[4].fontdata.size() == 0) returnv.erase(returnv.begin() + 4);
74 if (returnv[3].fontdata.size() == 0) returnv.erase(returnv.begin() + 3);
75 }
76#endif
77 return returnv;
78
79 }
80 returnv.resize(1);
81 std::string fn = "widgets/font/" +name + ".ttf";
82 returnv[0].fontdata = LoadFile(fn.c_str());
83 return returnv;
84}
85
86std::vector<uint8_t> LoadWidgetData(const std::string& name)
87{

Callers 1

CanvasFontGroupMethod · 0.85

Calls 9

stricmpFunction · 0.85
LoadFileFunction · 0.85
LoadDiskFileFunction · 0.85
c_strMethod · 0.80
resizeMethod · 0.45
GetCharsMethod · 0.45
sizeMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected