MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / _init_font

Function _init_font

modules/gui/gui/src/backend/paragraph/paragraph.cpp:12–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10{
11static SPtr<godot::FontFile> _font = nullptr;
12void _init_font()
13{
14 if (!_font)
15 {
16 std::fstream file("./../resources/font/SourceSansPro-Regular.ttf", std::ios::in | std::ios::binary);
17 if (file.is_open())
18 {
19 godot::PackedByteArray data = {};
20
21 file.seekg(0, std::ios::end);
22 size_t size = file.tellg();
23 file.seekg(0, std::ios::beg);
24 data.resize(size);
25 file.read((char*)data.ptrw(), size);
26 file.close();
27
28 _font = SPtr<godot::FontFile>::Create();
29 _font->set_data(data);
30 }
31 }
32}
33} // namespace skr::gui
34
35namespace skr::gui

Callers 1

_EmbeddedParagraphMethod · 0.85

Calls 7

CreateFunction · 0.50
is_openMethod · 0.45
resizeMethod · 0.45
readMethod · 0.45
ptrwMethod · 0.45
closeMethod · 0.45
set_dataMethod · 0.45

Tested by

no test coverage detected