Takashi Iwai <tiwai@xxxxxxx> さんは書きました: > At Fri, 10 Feb 2006 11:58:33 -0500, > Patrick Lam wrote: >> >> Ok, here's what I've discovered so far: >> >> * scalable=true isn't recognized by fc-match as a matching criterion. >> (_FcMatchers in fcmatch.c:187 is the list of matchers) >> >> * FcDefaultSubstitute adds a bunch of criteria to the pattern which >> cause the outline version to be rejected. >> >> * The criterion which causes the outline version to be rejected is >> FC_PIXEL_SIZE. FcDefaultSubstitute notes that we don't specify a >> pixelsize, so it computes one. (fcdefault.c lines 131-1515). >> Furthermore, FC_PIXEL_SIZE gets put before FC_OUTLINE, so that it >> eliminates the outline version before FC_OUTLINE can work. >> >> * Since the outline font doesn't have an FC_PIXEL_SIZE element, then it >> doesn't get the v = v * 100 + v1_offset, which causes it to have a lower >> score than the bitmap fonts, which is why it gets rejected. >> >> * The pattern elements are sorted to enable binary search on pattern >> elements, which is why pixelsize comes before outline. In fact, the >> matching pattern never has FcPatternGet called on it (it's only accessed >> sequentially), so we don't quite need to sort elements there, but that >> seems to enable a whole bunch of unsortedness bugs to come up. >> >> I don't know what the correct solution to this problem is, but that's >> what happening. Perhaps we shouldn't sort patterns used for matching. > > Stop blocking the fonts which have no corresponding elements. > The patch below should fix this problem. > > Takashi > > --- src/fcmatch.c-dist 2006-02-10 14:42:51.000000000 +0100 > +++ src/fcmatch.c 2006-02-10 17:55:00.000000000 +0100 > @@ -673,6 +673,10 @@ FcFontSetMatch (FcConfig *config, > } > } > > + /* We had no matching, just try the next one */ > + if (score == 1e99) > + continue; > + > /* If there's a previous champion, and current score > * beats previous best score, on this element, then > * knock out the previous champion and anything This patch alone was not enough. It fixed the problem on Takashi's machine, but not on my machine. Probably the reason was that the order of fonts in the cache files on Takashi's machine and my machine was different, i.e. it just accidentally "fixed" the problem on Takashi's machine. Takashi made a better patch, which is slightly more complicated. It is attached.
diff -ru fontconfig-2.3.93.20060210.orig/src/fcmatch.c fontconfig-2.3.93.20060210/src/fcmatch.c --- fontconfig-2.3.93.20060210.orig/src/fcmatch.c 2006-01-09 16:43:58.000000000 +0100 +++ fontconfig-2.3.93.20060210/src/fcmatch.c 2006-02-10 22:51:35.000000000 +0100 @@ -524,7 +524,7 @@ 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 @@ 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 @@ int cand_elt; FcPatternElt *cand_elts; - if (match_blocked[f + sets_offset[set]]) + if (match_blocked[f + sets_offset[set]] == 1) continue; score = 1e99; @@ -673,6 +673,13 @@ } } + /* 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 @@ -687,20 +694,20 @@ 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]; + // 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; }
-- Mike FABIAN <mfabian@xxxxxxx> http://www.suse.de/~mfabian 睡眠不足はいい仕事の敵だ。
_______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig