gpt4 book ai didi

FreeType FT_New_Memory_Face 崩溃

转载 作者:行者123 更新时间:2023-12-05 09:00:04 55 4
gpt4 key购买 nike

我已将“arial.ttf”文件(从我的/Windows/Fonts 文件夹中获取)加载到内存中,但是将其传递到 FT_New_Memory_Face 时会崩溃(在 FT_Open_Face 中的某处)。我无法对此进行调试,关于我可能做错了什么的任何线索?

unsigned char *fontBuffer = LoadFile("arial.ttf");
zip_uint64_t fSize = GetFileSize("arial.ttf");
FT_Library library; /* handle to library */
FT_Face face;
int error = FT_Init_FreeType( &library );
if( error != 0 )
printf("FT_Init_FreeType failed");

error = FT_New_Memory_Face( library,
(FT_Byte*)fontBuffer,
fSize,
0,
&face );

最佳答案

事实证明问题出在我这边,特别是 LoadFile 方法从堆栈而不是堆返回内存。图书馆工作正常。谢谢!

关于FreeType FT_New_Memory_Face 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7316201/

55 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com