[fcmatch] Move FcFontSetMatch() functionality into FcFontSetMatchInternal()

Except for the final FcFontRenderPrepare().  This way we have more
flexibility to do caching in FcFontMatch() while leaving FcFontSetMatch()
intact.
This commit is contained in:
Behdad Esfahbod 2008-12-31 20:16:40 -05:00
parent a5a384c5ff
commit 6d764a3f9b
1 changed files with 29 additions and 13 deletions

View File

@ -459,8 +459,8 @@ FcFontRenderPrepare (FcConfig *config,
return new; return new;
} }
FcPattern * static FcPattern *
FcFontSetMatch (FcConfig *config, FcFontSetMatchInternal (FcConfig *config,
FcFontSet **sets, FcFontSet **sets,
int nsets, int nsets,
FcPattern *p, FcPattern *p,
@ -481,12 +481,6 @@ FcFontSetMatch (FcConfig *config,
printf ("Match "); printf ("Match ");
FcPatternPrint (p); FcPatternPrint (p);
} }
if (!config)
{
config = FcConfigGetCurrent ();
if (!config)
return 0;
}
for (set = 0; set < nsets; set++) for (set = 0; set < nsets; set++)
{ {
s = sets[set]; s = sets[set];
@ -537,6 +531,25 @@ FcFontSetMatch (FcConfig *config,
*result = FcResultNoMatch; *result = FcResultNoMatch;
return 0; return 0;
} }
return best;
}
FcPattern *
FcFontSetMatch (FcConfig *config,
FcFontSet **sets,
int nsets,
FcPattern *p,
FcResult *result)
{
FcPattern *best;
if (!config)
{
config = FcConfigGetCurrent ();
if (!config)
return 0;
}
best = FcFontSetMatchInternal (config, sets, nsets, p, result);
return FcFontRenderPrepare (config, p, best); return FcFontRenderPrepare (config, p, best);
} }
@ -547,6 +560,7 @@ FcFontMatch (FcConfig *config,
{ {
FcFontSet *sets[2]; FcFontSet *sets[2];
int nsets; int nsets;
FcPattern *best;
if (!config) if (!config)
{ {
@ -559,7 +573,9 @@ FcFontMatch (FcConfig *config,
sets[nsets++] = config->fonts[FcSetSystem]; sets[nsets++] = config->fonts[FcSetSystem];
if (config->fonts[FcSetApplication]) if (config->fonts[FcSetApplication])
sets[nsets++] = config->fonts[FcSetApplication]; sets[nsets++] = config->fonts[FcSetApplication];
return FcFontSetMatch (config, sets, nsets, p, result);
best = FcFontSetMatchInternal (config, sets, nsets, p, result);
return FcFontRenderPrepare (config, p, best);
} }
typedef struct _FcSortNode { typedef struct _FcSortNode {