loadFontBuffer method
Load font data.
The function loadFontData loads font data from memory. The data is not copied, the user needs to make sure the data lives at least as long as FreeType2. After the FreeType2 object is destroyed, the buffer can be safely deallocated.
buffer
buffer containing font data
idx
face_index to select a font faces in a single file.
Implementation
void loadFontBuffer(Uint8List buffer, int idx) {
final cbuffer = malloc<ffi.Uint8>(buffer.length);
cbuffer.asTypedList(buffer.length).setAll(0, buffer);
cvRun(
() => ccontrib.cv_freetype_FreeType2_loadFontData_buf(
ref,
cbuffer.cast<ffi.Char>(),
buffer.length,
idx,
ffi.nullptr,
),
);
malloc.free(cbuffer);
}