FreeType的。如何知道FT_Face及其索引中的符号数?

时间:2015-04-07 08:59:52

标签: c++ freetype

我想知道FT_Face中包含的所有符号以将其渲染为纹理。 FT_FaceRec有" FT_Long num_glyphs;"但它只告诉我它的数量,而不是它的指数。

我可以做点什么 对于(wchat_t c = 0; c< max_value; c ++)   //在这里加载字符c

但是通过这种方式我会有很多"矩形"如果字体没有字符。这是因为它的矩形将在纹理中取消区域。

如何知道字体真正包含的字符的glyph_index或wchar_t?

2 个答案:

答案 0 :(得分:0)

可以通过函数遍历font face中的所有字符: 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
}

答案 1 :(得分:0)

freetype wrapper

基于Ogre Font Class,但使用多个纹理来存储字形,每个纹理都有固定的大小。