MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / loadFile

Method loadFile

src/override/Window.cpp:88–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86
87
88void Font::loadFile(const std::string& filename, NVGcontext* vg) {
89 this->vg = vg;
90 std::string name = system::getStem(filename);
91 size_t size;
92 // Transfer ownership of font data to font object
93 uint8_t* data = system::readFile(filename, &size);
94 // Don't use nvgCreateFont because it doesn't properly handle UTF-8 filenames on Windows.
95 handle = nvgCreateFontMem(vg, name.c_str(), data, size, 1);
96 if (handle < 0) {
97 throw Exception("Failed to load font %s", filename.c_str());
98 }
99 INFO("Loaded font %s", filename.c_str());
100}
101
102
103std::shared_ptr<Font> Font::load(const std::string& filename) {

Callers 1

Window.cppFile · 0.45

Calls 3

c_strMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected