]> git.wh0rd.org - fontconfig.git/commitdiff
Fix FT_Get_Next_Char API to match official 2.0.9 released version
authorKeith Packard <keithp@keithp.com>
Wed, 27 Mar 2002 04:33:55 +0000 (04:33 +0000)
committerKeith Packard <keithp@keithp.com>
Wed, 27 Mar 2002 04:33:55 +0000 (04:33 +0000)
src/fccharset.c

index b508ed81b4c69493583c84092c93c1c0a1be5a6d..1772cf966adb124278867c28b6e564ecb4e84b21 100644 (file)
@@ -812,7 +812,7 @@ FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c)
 #   define HAS_NEXT_CHAR
 #  else
 #   if FREETYPE_MINOR == 0
-#    if FREETYPE_PATCH >= 8
+#    if FREETYPE_PATCH >= 9
 #     define HAS_NEXT_CHAR
 #    endif
 #   endif
@@ -824,7 +824,10 @@ FcNameUnparseCharSet (FcStrBuf *buf, const FcCharSet *c)
  * For our purposes, this approximation is sufficient
  */
 #ifndef HAS_NEXT_CHAR
-#define FT_Get_Next_Char(face, ucs4) ((ucs4) >= 0xffffff ? 0 : (ucs4) + 1)
+#define FT_Get_First_Char(face, gi) ((*(gi) = 1), 1)
+#define FT_Get_Next_Char(face, ucs4, gi) ((ucs4) >= 0xffffff ? \
+                                         (*(gi) = 0), 0 : \
+                                         (*(gi) = 1), (ucs4) + 1)
 #warning "No FT_Get_Next_Char"
 #endif
 
@@ -1464,18 +1467,25 @@ FcFreeTypeCharSet (FT_Face face, FcBlanks *blanks)
        }
        else
        {
-           max = fcFontDecoders[o].max;
+           FT_UInt gindex;
          
+           max = fcFontDecoders[o].max;
            /*
             * Find the first encoded character in the font
             */
-           ucs4 = 0;
            if (FT_Get_Char_Index (face, 0))
+           {
                ucs4 = 0;
+               gindex = 1;
+           }
            else
-               ucs4 = FT_Get_Next_Char (face, 0);
+           {
+               ucs4 = FT_Get_Next_Char (face, 0, &gindex);
+               if (!ucs4)
+                   gindex = 0;
+           }
 
-           for (;;)
+           while (gindex)
            {
                page = ucs4 >> 8;
                leaf = 0;
@@ -1500,9 +1510,9 @@ FcFreeTypeCharSet (FT_Face face, FcBlanks *blanks)
                    }
                    ucs4++;
                }
-               ucs4 = FT_Get_Next_Char (face, ucs4 - 1);
+               ucs4 = FT_Get_Next_Char (face, ucs4 - 1, &gindex);
                if (!ucs4)
-                   break;
+                   gindex = 0;
            }
 #ifdef CHECK
            for (ucs4 = 0; ucs4 < 0x10000; ucs4++)