Expose ability to build an FcPattern directly from an FT_Face
object.
dnl bump revision when fixing bugs
dnl bump current and age, reset revision to zero when adding APIs
dnl bump current, leave age, reset revision to zero when changing/removing APIS
dnl bump revision when fixing bugs
dnl bump current and age, reset revision to zero when adding APIs
dnl bump current, leave age, reset revision to zero when changing/removing APIS
LT_REVISION=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
LT_REVISION=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
LT_VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE"
AC_SUBST(LT_VERSION_INFO)
LT_VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE"
AC_SUBST(LT_VERSION_INFO)
@TYPE2@ int @ARG2@ id
@TYPE3@ FcBlanks * @ARG3@ blanks
@TYPE4@ int * @ARG4@ count
@TYPE2@ int @ARG2@ id
@TYPE3@ FcBlanks * @ARG3@ blanks
@TYPE4@ int * @ARG4@ count
-@PURPOSE@ compute font file pattern
+@PURPOSE@ compute pattern from font file (and index)
@DESC@
Constructs a pattern representing the 'id'th font in 'file'. The number
of fonts in 'file' is returned in 'count'.
@@
@DESC@
Constructs a pattern representing the 'id'th font in 'file'. The number
of fonts in 'file' is returned in 'count'.
@@
+
+@SYNOPSIS@
+#include <fontconfig.h>
+#include <fcfreetype.h>
+@RET@ FcPattern *
+@FUNC@ FcFreeTypeQueryFace
+@TYPE1@ const FT_Face @ARG1@ face
+@TYPE2@ const char * @ARG2@ file
+@TYPE3@ int @ARG3@ id
+@TYPE4@ FcBlanks * @ARG4@ blanks
+@PURPOSE@ compute pattern from FT_Face
+@DESC@
+Constructs a pattern representing 'face'. 'file' and 'id' are used solely as
+data for pattern elements (FC_FILE, FC_INDEX and sometimes FC_FAMILY).
+@@
FcPublic FcBool
FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f);
FcPublic FcBool
FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f);
+FcPublic FcPattern *
+FcFreeTypeQueryFace (const FT_Face face,
+ const FcChar8 *file,
+ int id,
+ FcBlanks *blanks);
+
#define NUM_NAMEID_ORDER (sizeof (nameid_order) / sizeof (nameid_order[0]))
FcPattern *
#define NUM_NAMEID_ORDER (sizeof (nameid_order) / sizeof (nameid_order[0]))
FcPattern *
-FcFreeTypeQuery (const FcChar8 *file,
- int id,
- FcBlanks *blanks,
- int *count)
+FcFreeTypeQueryFace (const FT_Face face,
+ const FcChar8 *file,
+ int id,
+ FcBlanks *blanks)
FcPattern *pat;
int slant = -1;
int weight = -1;
FcPattern *pat;
int slant = -1;
int weight = -1;
int i;
FcCharSet *cs;
FcLangSet *ls;
int i;
FcCharSet *cs;
FcLangSet *ls;
#if 0
FcChar8 *family = 0;
#endif
#if 0
FcChar8 *family = 0;
#endif
FcChar8 *style = 0;
int st;
FcChar8 *style = 0;
int st;
- if (FT_Init_FreeType (&ftLibrary))
- return 0;
-
- if (FT_New_Face (ftLibrary, (char *) file, id, &face))
- goto bail;
-
- *count = face->num_faces;
-
pat = FcPatternCreate ();
if (!pat)
goto bail0;
pat = FcPatternCreate ();
if (!pat)
goto bail0;
*/
FcCharSetDestroy (cs);
*/
FcCharSetDestroy (cs);
- /*
- * Deallocate family/style values
- */
-
- FT_Done_Face (face);
- FT_Done_FreeType (ftLibrary);
bail1:
FcPatternDestroy (pat);
bail0:
bail1:
FcPatternDestroy (pat);
bail0:
+ return NULL;
+}
+
+FcPattern *
+FcFreeTypeQuery(const FcChar8 *file,
+ int id,
+ FcBlanks *blanks,
+ int *count)
+{
+ FT_Face face;
+ FT_Library ftLibrary;
+ FcPattern *pat = NULL;
+
+ if (FT_Init_FreeType (&ftLibrary))
+ return NULL;
+
+ if (FT_New_Face (ftLibrary, (char *) file, id, &face))
+ goto bail;
+
+ *count = face->num_faces;
+
+ pat = FcFreeTypeQueryFace (face, file, id, blanks);
+
FT_Done_Face (face);
bail:
FT_Done_FreeType (ftLibrary);
FT_Done_Face (face);
bail:
FT_Done_FreeType (ftLibrary);
/*
* For our purposes, this approximation is sufficient
*/
/*
* For our purposes, this approximation is sufficient
*/