解释可能出了什么问题。
我使用freetype上传ttf文件。 我使用这个简单的代码:
#include <iostream>
#include "ft2build.h"
#include "freetype\freetype.h"
int main()
{
FT_Library FT_Library_;
FT_Face FT_Face_;
FT_Init_FreeType(&FT_Library_);
//---------------------------------------------------------
std ::string my_string_for_read;
my_load_from_disk(my_string_for_read); //loads ttf file from disk
//---------------------------------------------------------
const FT_Byte* font_data = (unsigned char*)&my_string_for_read[0];
int status = FT_New_Memory_Face(FT_Library_, font_data, my_string_for_read.size(), 0, &FT_Face_);
if (status != 0)
{
std ::cout<<"error";
return -1;
}
FT_UInt glyph_index;
FT_ULong char_code;
char_code = FT_Get_First_Char(FT_Face_, &glyph_index);
if (char_code == 0)
{
std::cout<<"no glyphs";
}
}
我在两个带有中文字符的 ttf 文件上尝试了这段代码 - 它没有问题。
但是例如,在另一个带有希腊字符“Greek.ttf”的 ttf 文件上 - freetype 看不到字形 :(
虽然我在网站上检查了这个“Greek.ttf”https://fontdrop.info/ - 它显示了这个文件中的字形没有任何问题。
可能是什么问题?
这里是 Greek.ttf 文件的链接:https://file.io/6COvqSNxNa1m