From 537e3d23fab449be154da8d49817364479924a61 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 5 Dec 2004 00:26:06 +0000 Subject: [PATCH] Create FC_FONTFORMAT from FT_Get_X11_Font_Format function where available. This provides font file format information (BDF, Type 1, PCF, TrueType) for each font. Closes #109. --- ChangeLog | 10 ++++++++++ configure.in | 2 +- fontconfig/fontconfig.h | 1 + src/fcfreetype.c | 14 ++++++++++++++ src/fcname.c | 1 + 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b89f20b..fa19016 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-12-04 Keith Packard + + * configure.in: + * fontconfig/fontconfig.h: + * src/fcfreetype.c: (FcFreeTypeQuery): + * src/fcname.c: + Create FC_FONTFORMAT from FT_Get_X11_Font_Format function where + available. This provides font file format information (BDF, Type 1, + PCF, TrueType) for each font. Closes #109. + 2004-12-04 Daniel Glassey reviewed by: Keith Packard diff --git a/configure.in b/configure.in index 71f6742..d28c7bf 100644 --- a/configure.in +++ b/configure.in @@ -134,7 +134,7 @@ fontconfig_save_libs="$LIBS" fontconfig_save_cflags="$CFLAGS" LIBS="$LIBS $FREETYPE_LIBS" CFLAGS="$CFLAGS $FREETYPE_CFLAGS" -AC_CHECK_FUNCS(FT_Get_Next_Char FT_Get_BDF_Property FT_Get_PS_Font_Info FT_Has_PS_Glyph_Names) +AC_CHECK_FUNCS(FT_Get_Next_Char FT_Get_BDF_Property FT_Get_PS_Font_Info FT_Has_PS_Glyph_Names FT_Get_X11_Font_Format) AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem, HAVE_FT_BITMAP_SIZE_Y_PPEM=1, HAVE_FT_BITMAP_SIZE_Y_PPEM=0, diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index 6758f27..fbccbbf 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -94,6 +94,7 @@ typedef int FcBool; #define FC_STYLELANG "stylelang" /* String RFC 3066 langs */ #define FC_FULLNAMELANG "fullnamelang" /* String RFC 3066 langs */ #define FC_CAPABILITY "capability" /* String */ +#define FC_FONTFORMAT "fontformat" /* String */ #define FC_DIR_CACHE_FILE "fonts.cache-"FC_CACHE_VERSION #define FC_USER_CACHE_FILE ".fonts.cache-"FC_CACHE_VERSION diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 0c2eafd..7ca65fd 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -58,6 +58,9 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H #include FT_INTERNAL_TRUETYPE_TYPES_H +#if HAVE_FT_GET_X11_FONT_FORMAT +#include FT_XFREE86_H +#endif #if HAVE_FT_GET_BDF_PROPERTY #include FT_BDF_H @@ -1614,6 +1617,17 @@ FcFreeTypeQuery (const FcChar8 *file, ; #endif } +#if HAVE_FT_GET_X11_FONT_FORMAT + /* + * Use the (not well documented or supported) X-specific function + * from FreeType to figure out the font format + */ + { + const char *font_format = FT_Get_X11_Font_Format (face); + if (font_format) + FcPatternAddString (pat, FC_FONTFORMAT, font_format); + } +#endif /* * Drop our reference to the charset diff --git a/src/fcname.c b/src/fcname.c index 776fba8..c3b7698 100644 --- a/src/fcname.c +++ b/src/fcname.c @@ -68,6 +68,7 @@ static const FcObjectType _FcBaseObjectTypes[] = { { FC_LANG, FcTypeLangSet }, { FC_FONTVERSION, FcTypeInteger }, { FC_CAPABILITY, FcTypeString }, + { FC_FONTFORMAT, FcTypeString }, }; #define NUM_OBJECT_TYPES (sizeof _FcBaseObjectTypes / sizeof _FcBaseObjectTypes[0]) -- 2.39.2