我想知道 FT_Face 中包含的所有符号以将其渲染为纹理。 FT_FaceRec 有“FT_Long num_glyphs;”但它只告诉我它的数量,而不是它的索引。
我可以做点什么 对于 (wchat_t c = 0; c < max_value; c++) //在这里加载字符 c
但是如果字体没有字符,这样我就会有很多“矩形”。这是开销,因为它的矩形将在纹理中去除区域。
如何知道字体真正包含的字符的 glyph_index 或 wchar_t?
最佳答案
可以通过函数遍历字体中的所有字符: FT_Get_First_Char 和 FT_Get_Next_Char
例子:
FT_UInt index;
FT_ULong character = FT_Get_First_Char(face, &index);
while (true) {
// to do something
character = FT_Get_Next_Char(face, character, &index);
if (!index) break; // if FT_Get_Next_Char write 0 to index then
// have no more characters in font face
}
关于c++ - 免费类型。如何知道 FT_Face 及其索引中的符号数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29487672/