Hello,
I have a problem during the integration with the FreeType library.
With the standard C, the code should be similar to this snippet:
FT_Library value;
FT_Error status;
FT_Face face;
status = FT_Init_FreeType (& value);
status = FT_New_Face (value, filename, 0, & face);
NOTE: FT_Face and FT_Library are typedef to struct pointers.
Using swift, i have tried several solutions with Pointers but every tentative generates a segmentation fault.
My last not working solution was:
self.lib = FT_Library(UnsafeRawPointer(UnsafeMutableRawPointer.allocate(byteCount: 1, alignment: 1)))
let libPt = UnsafeMutablePointer<FT_Library?>(self.lib)
let status = FT_Init_FreeType(libPt)
var face: UnsafeMutablePointer<FT_Face?>!
let status = FT_New_Face(lib, fileName, 0, face)
Any help?
Environment:
- Linux Debian
- Swift version - swift-4.1.2-RELEASE -