Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请教个问题? #846

Closed
ytchw101 opened this issue Jul 10, 2023 · 1 comment
Closed

请教个问题? #846

ytchw101 opened this issue Jul 10, 2023 · 1 comment

Comments

@ytchw101
Copy link

你好,目前我这边是嵌入式工程移植awtk + RTT + 文件系统 且从程序SD卡启动(根目录设置为SD卡根目录 tk_init(lcd_w, lcd_h, APP_MOBILE, NULL, ROOT_DIR_SD);) 运行显示一切正常! 字体管理(解析采用 stb方式即打开宏 WITH_STB_FONT)都正常
我想问的是: 我改成freetype方式加载 (不想用 FT_New_Memory_Face 从内存加载 因为从内存加载 需要把字体先预加载到内存感觉 慢) 我使用下面:
请问: 不管我自己移植一个freetype2源码进来或者使用系统自带的freetype.h ,总是在FT_New_Face 时返回错误码2(即FT_Err_Unknown_File_Format)
FT_Err_Unknown_File_Format: 表示可以打开,读这个文件,但是不支持它的格式,
其他非零的返回值,表示不能打开跟读该文件.返回零表示装载成功
我移植了2个版本freetype2 源码最终都是这个错误提示, 不知道是跟系统哪里冲突吗?还是什么原因,不得其解?
freetype2 解析 ttf矢量字体 应该没问题啊,文件路径我也检查应该都是对的,我换成xxx.ttc字体也是不行,不知为什么总提示不支持此格式?

示例:
FT_Library pFTLib = NULL;
FT_Face pFTFace = NULL;
FT_Error error = 0 ;
error = FT_Init_FreeType(&pFTLib);
rt_kprintf("FT_Init_FreeType error=%d \n",error);
if(file_exist("/SD/songti.ttf")) //存在
{
rt_kprintf("songti.ttf is exist!\r\n");
}
else
{
rt_kprintf("Not found songti.ttf!\r\n");
FT_Done_FreeType(pFTLib);
pFTLib = NULL;
return 0;
}
error = FT_New_Face(pFTLib, "/SD/songti.ttf", 0, &pFTFace);
.....

@ytchw101
Copy link
Author

已搞定! 打扰了........

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant