MCPcopy Create free account
hub / github.com/aardappel/treesheets / LoadFont

Function LoadFont

lobster/src/fontrenderer.cpp:197–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197OutlineFont *LoadFont(string_view name) {
198 FT_Error err = 0;
199 if (!library) err = FT_Init_FreeType(&library);
200 if (!err) {
201 string fbuf;
202 if (LoadFile(name, &fbuf) >= 0) {
203 FT_Face face;
204 err = FT_New_Memory_Face(library, (const FT_Byte *)fbuf.c_str(), (FT_Long)fbuf.length(),
205 0, &face);
206 if (!err) return new OutlineFont(face, fbuf);
207 }
208 }
209 return nullptr;
210}
211
212OutlineFont::~OutlineFont() {
213 FT_Done_Face((FT_Face)fthandle);

Callers 1

AddFontFunction · 0.85

Calls 3

lengthMethod · 0.80
LoadFileFunction · 0.70
c_strMethod · 0.45

Tested by

no test coverage detected