[Fontconfig] How to obtain FT_Face?

Kenichi Handa handa at m17n.org
Fri Apr 23 17:10:42 EST 2004


Reference manual version 2.2.2 has this API:

FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4);

But I can't get face object.  I tried this:

  fc = FcInitLoadConfigAndFonts ();
  pat = FcPatternCreate ();
  FcPatternAddString (pat, FC_FAMILY, "raghindi");
  os = FcObjectSetBuild (FC_FT_FACE, NULL);
  fs = FcFontList(fc, pat, os);
  for (i = 0; i < fs->nfont; i++)
      result = FcPatternGet (fs->fonts[i], FC_FT_FACE, 0, &v);
      if (result == FcResultMatch)
	printf ("Success\n");
	printf ("Error\n");

It always prints only "Error".  I tried the other fonts than
"raghindi" but couldn't succeed.

In fcfreetype.h, I found this API (not described in the
reference manual, does it mean that this is not a public

FcPatternGetFTFace (const FcPattern *p, const char *object, int n, FT_Face *f);

   result = FcPatternGetFTFace (fs->fonts[i], FC_FT_FACE, 0, &face);
also failed.

Could someone tell me how to get FT_Face object?


Ken'ichi HANDA
handa at m17n.org

More information about the Fontconfig mailing list