]> git.wh0rd.org - fontconfig.git/commitdiff
Lean on autoconf to find useful FreeType functions (bug 95)
authorKeith Packard <keithp@keithp.com>
Wed, 25 Jun 2003 23:21:03 +0000 (23:21 +0000)
committerKeith Packard <keithp@keithp.com>
Wed, 25 Jun 2003 23:21:03 +0000 (23:21 +0000)
configure.in
src/fcfreetype.c

index 21652b1899baa0737120952753b71b656ab42f0b..20b9dce1bd502eb90e3e433125db3305f2a26507 100644 (file)
@@ -113,12 +113,15 @@ AC_SUBST(FREETYPE_LIBS)
 AC_SUBST(FREETYPE_CFLAGS)
 
 #
-# Check to see whether we have FT_Get_First_Char(), new in 2.0.9
+# Check to see whether we have:
+#  FT_Get_Next_Char
+#  FT_Get_BDF_Property
+#  FT_Get_PS_Font_Info
 #
 
 fontconfig_save_libs=$LIBS
 LIBS="$LIBS $FREETYPE_LIBS"
-AC_CHECK_FUNCS(FT_Get_First_Char)
+AC_CHECK_FUNCS(FT_Get_Next_Char FT_Get_BDF_Property FT_Get_PS_Font_Info)
 LIBS=$fontconfig_save_libs
 
 #
index df13ad369932f89f87582cda548a8dce1419819a..60e067662ba46fe948d519e25e04419d752063c6 100644 (file)
 #include <freetype/ttnameid.h>
 #include <freetype/t1tables.h>
 
-#if (FREETYPE_MINOR > 1 || (FREETYPE_MINOR == 1 && FREETYPE_PATCH >= 4))
+#if HAVE_FT_GET_BDF_PROPERTY
 #include <freetype/ftbdf.h>
 #include <freetype/ftmodule.h>
-#define USE_FTBDF
 #define HAS_BDF_PROPERTY(f) ((f) && (f)->driver && \
                             (f)->driver->root.clazz->get_interface)
 #define MY_Get_BDF_Property(f,n,p) (HAS_BDF_PROPERTY(f) ? \
                                    FT_Err_Invalid_Argument)
 #endif
 
+#if !HAVE_FT_GET_BDF_PROPERTY
+#warning "No FT_Get_BDF_Property"
+#endif
+
+#if !HAVE_FT_GET_PS_FONT_INFO
+#warning "No FT_Get_Font_Info"
+#endif
 
 /*
  * Keep Han languages separated by eliminating languages
@@ -357,8 +363,10 @@ FcFreeTypeQuery (const FcChar8     *file,
     const FcChar8   *foundry = 0;
     int                    spacing;
     TT_OS2         *os2;
+#if HAVE_FT_GET_PS_FONT_INFO
     PS_FontInfoRec  psfontinfo;
-#ifdef USE_FTBDF
+#endif
+#if HAVE_FT_GET_BDF_PROPERTY
     BDF_PropertyRec prop;
 #endif
     TT_Header      *head;
@@ -793,6 +801,7 @@ FcFreeTypeQuery (const FcChar8      *file,
      * Code from g2@magestudios.net (Gerard Escalante)
      */
     
+#if HAVE_FT_GET_PS_FONT_INFO
     if (FT_Get_PS_Font_Info(face, &psfontinfo) == 0)
     {
        if (weight == -1 && psfontinfo.weight)
@@ -817,8 +826,9 @@ FcFreeTypeQuery (const FcChar8      *file,
         if(!foundry)
             foundry = FcNoticeFoundry(psfontinfo.notice);
     }
+#endif /* HAVE_FT_GET_PS_FONT_INFO */
     
-#ifdef USE_FTBDF
+#if HAVE_FT_GET_BDF_PROPERTY
     /*
      * Finally, look for a FOUNDRY BDF property if no other
      * mechanism has managed to locate a foundry
@@ -866,7 +876,6 @@ FcFreeTypeQuery (const FcChar8      *file,
                printf ("\tsetwidth %s maps to %d\n", prop.u.atom, width);
        }
     }
-
 #endif
 
     /*
@@ -934,7 +943,7 @@ FcFreeTypeQuery (const FcChar8      *file,
     if (!cs)
        goto bail1;
 
-#ifdef USE_FTBDF
+#if HAVE_FT_GET_BDF_PROPERTY
     /* For PCF fonts, override the computed spacing with the one from
        the property */
     if(MY_Get_BDF_Property(face, "SPACING", &prop) == 0 &&
@@ -985,7 +994,7 @@ FcFreeTypeQuery (const FcChar8      *file,
                goto bail1;
        if (!FcPatternAddBool (pat, FC_ANTIALIAS, FcFalse))
            goto bail1;
-#ifdef USE_FTBDF
+#if HAVE_FT_GET_BDF_PROPERTY
         if(face->num_fixed_sizes == 1) {
             int rc;
             int value;
@@ -1062,31 +1071,10 @@ bail:
 }
 
 
-/*
- * Figure out whether the available freetype has FT_Get_Next_Char
- */
-
-#if FREETYPE_MAJOR > 2
-# define HAS_NEXT_CHAR
-#else
-# if FREETYPE_MAJOR == 2
-#  if FREETYPE_MINOR > 0
-#   define HAS_NEXT_CHAR
-#  else
-#   if FREETYPE_MINOR == 0
-#    if FREETYPE_PATCH >= 9
-#     define HAS_NEXT_CHAR
-#    endif
-#   endif
-#  endif
-# endif
-#endif
-
 /*
  * For our purposes, this approximation is sufficient
  */
-#ifndef HAS_NEXT_CHAR
-#define FT_Get_First_Char(face, gi) ((*(gi) = 1), 1)
+#if !HAVE_FT_GET_NEXT_CHAR
 #define FT_Get_Next_Char(face, ucs4, gi) ((ucs4) >= 0xffffff ? \
                                          (*(gi) = 0), 0 : \
                                          (*(gi) = 1), (ucs4) + 1)