]> git.wh0rd.org Git - fontconfig.git/commitdiff
Use a tri-state to mark the fonts which didn't get blocked but were just
authorPatrick Lam <plam@MIT.EDU>
Sat, 11 Feb 2006 04:50:46 +0000 (04:50 +0000)
committerPatrick Lam <plam@MIT.EDU>
Sat, 11 Feb 2006 04:50:46 +0000 (04:50 +0000)
    missing an element, to distinguish them from the fonts that do match
    the element.
reviewed by: plam

ChangeLog
src/fcmatch.c

index 23e74e2dffbfcc1158d999c08bebb4f506a5b04d..fb6a699b333013d58db7f8b7e472e524133b8683 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-02-10  Takashi Iwai  <tiwai@suse.de>
+       reviewed by: plam
+       * src/fcmatch.c (FcFontSetMatch):
+
+       Use a tri-state to mark the fonts which didn't get blocked but
+       were just missing an element, to distinguish them from the
+       fonts that do match the element.
+
 2006-02-10  Takashi Iwai  <tiwai@suse.de>
        reviewed by: plam
        * src/fcmatch.c (FcFontSetMatch):
index 30336ffdd4ab4e51d97593215fe0eded2b0e0c79..57e0c0e78b8d6968624a4fbf342a475a1a1f0f18 100644 (file)
@@ -524,7 +524,7 @@ FcFontSetMatch (FcConfig    *config,
     FcMatcher      *weak_matchers[NUM_MATCH_VALUES];
     FcPatternElt    *pat_elts[NUM_MATCH_VALUES];
     int                    pat_elt;
-    FcBool         *match_blocked;
+    int                    *match_blocked;
     int                    block_start;
 
     if (!nsets || !sets || !p)
@@ -560,7 +560,7 @@ FcFontSetMatch (FcConfig    *config,
 
     fonts_left = nfonts;
 
-    match_blocked = (FcBool*)calloc(nfonts, sizeof(FcBool));
+    match_blocked = (int*)calloc(nfonts, sizeof(int));
 
     /* Find out all necessary matchers first, so we don't need to find them
      * in every loop.
@@ -631,7 +631,7 @@ FcFontSetMatch (FcConfig    *config,
                    int             cand_elt;
                    FcPatternElt    *cand_elts;
 
-                   if (match_blocked[f + sets_offset[set]])
+                   if (match_blocked[f + sets_offset[set]] == 1)
                        continue;
 
                    score = 1e99;
@@ -675,8 +675,11 @@ FcFontSetMatch (FcConfig    *config,
 
                    /* We had no matching, just try the next one */
                    if (score == 1e99)
+                   {
+                       match_blocked[f + sets_offset[set]] = 2;
                        continue;
-
+                   }
+                   match_blocked[f + sets_offset[set]] = 0;
                    /* If there's a previous champion, and current score
                     * beats previous best score, on this element, then
                     * knock out the previous champion and anything
@@ -691,20 +694,21 @@ FcFontSetMatch (FcConfig    *config,
                            for (b = block_start; b < f + sets_offset[set]; ++b)
                                if (!match_blocked[b])
                                {
-                                   match_blocked[b] = FcTrue;
+                                   match_blocked[b] = 1;
                                    --fonts_left;
                                }
                        }
 
                        bestscore = score;
                        best = s->fonts[f];
-                       block_start = f + sets_offset[set];
+                       /* This kills too many fonts, unfortunately. */
+                       /* block_start = f + sets_offset[set]; */
                    }
 
                    /* If f loses, then it's out too. */
                    if (best && score > bestscore)
                    {
-                       match_blocked[f + sets_offset[set]] = FcTrue;
+                       match_blocked[f + sets_offset[set]] = 1;
                        --fonts_left;
                    }