MCPcopy Create free account
hub / github.com/defold/defold / LoadHBFont

Function LoadHBFont

engine/font/src/font_ttf.cpp:193–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191
192#if defined(FONT_USE_HARFBUZZ)
193static int LoadHBFont(TTFFont* font, void* buffer, uint32_t buffer_size)
194{
195 hb_blob_t* blob = 0;
196 hb_face_t* face = 0;
197 int result = 0;
198
199 blob = hb_blob_create((const char*)buffer, buffer_size, HB_MEMORY_MODE_READONLY, 0, 0);
200 if (!blob) goto cleanup;
201
202 face = hb_face_create(blob, 0);
203 if (!face) goto cleanup;
204
205 font->m_HBFont = hb_font_create(face);
206 result = font->m_HBFont != 0;
207
208cleanup:
209 hb_face_destroy(face);
210 hb_blob_destroy(blob);
211 return result;
212}
213#endif
214
215static HFont LoadTTFInternal(const char* path, const void* buffer, uint32_t buffer_size, bool allocate)

Callers 1

LoadTTFInternalFunction · 0.85

Calls 5

hb_blob_createFunction · 0.85
hb_face_createFunction · 0.85
hb_font_createFunction · 0.85
hb_face_destroyFunction · 0.85
hb_blob_destroyFunction · 0.85

Tested by

no test coverage detected