我正在尝试从Windows"Segoe UI Emoji"渲染彩色字形 - 使用最新的freetype 2.8.1(我从源代码编译x64调试版本,没有单线程或多线程)和OpenGL.所以,我用的是seguiemj.ttf从Windows\Fonts目录(SHA256 = d67717a6fe84e21bc580443add16ec920e6988ca067041d0461c641f75074a8c),但FT_HAS_COLOR始终返回false.我也尝试使用来自githubEmojiOneColor-SVGinOT.ttf的eosrei,这导致了相同的行为.
当这个文件用于android时,FT_HAS_COLOR返回true并且位图槽也不会被填充.
FT_Library library;
FT_Face face;
FT_Init_FreeType(&library);
FT_New_Face(library, "resources/fonts/seguiemj.ttf", 0, &face);
bool has_color = FT_HAS_COLOR(face);
debug(LOG_INFO, 0, "font has colors: %s", has_color ? "yes" : "no");
std::u32string s = U" ";
FT_GlyphSlot slot = face->glyph;
for (auto c : s)
{
int glyph_index = FT_Get_Char_Index(face, c);
FT_Error error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT|FT_LOAD_COLOR);
if (error)
continue;
error = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL); …Run Code Online (Sandbox Code Playgroud)